Piotr,
On Fri, Nov 24, 2017 at 2:59 AM, Piotr Chabot Stadhouders via 4D_Tech <
[email protected]> wrote:
> As an example I have the following scenario:
> An employee form with a lot of fields and a checkbox “manager” on page 1
> Other fields on page 2
> The items of some “dropdown lists” (custom widget) on page 2 depend on the
> manager status (checkbox) on page 1
>
> So when going through the records with next/previous buttons and being on
> page 2 I have to re-populate the dropdown widgets when the manager status
> changes
> But now, when being on page 1 and going to page 2 for the first time I
> also have to populate the dropdown widget.
>
Good example. The way I'd approach this is in the On load event of the
parent form:
EXECUTE METHOD IN
SUBFORM("dropdown_widget";"config_employee_widget";*;$isManager)
'config_employee_widget' would also set the display value. The only action
the subform needs to deal with is the On data change event. You know you
could just set the drop down display value at this point and populate the
actual list when/if the user clicks on it.
I'd run that same code in response to the checkbox changing as well.
So now I have 2 places where I have to populate (by method or not) the
> dropdown widget
>
Personally I don't use drop downs for this sort of selection very often.
Totally an aesthetic thing for me but I prefer to either use a button or a
form var and a button.
For the button alone I set the button title to the selected value when the
parent form loads. On Click I build and display a menu of options, store
the user choice and update the button title.
The other interface is a non-enterable var to display the value and some
small graphic, like a hamburger button
<https://vtldesign.com/web-strategy/website-design-development/hamburger-icon-flyout-menu-website-navigation/>,
to manage the popup menu.
These approaches don't require any list building unless something actually
changes. I used to be concerned about the processing required for doing
this this sort of stuff on-the-fly but the truth is both 4D and hardware
are powerful enough it's rare it makes any difference on user forms.
--
Kirk Brooks
San Francisco, CA
=======================
*The only thing necessary for the triumph of evil is for good men to do
nothing.*
*- Edmund Burke*
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************