Jim,
I use On click as well, but I rarely use dropdowns that are enterable
(combo lists). In that case you want to recognize the data change event to
do whatever in that case. Or turn off the On data change event and make the
list non-enterable so you only have On clicked events to handle.

As far as 'causing' other events On click doesn't do that but it does
register on the form itself. So, when you click a button the button object
fires an On click event if you have that event enabled for it. After the
button method runs the On click event is passed on to the form method and
if you have On click enabled on the FORM that method runs.

I suggest you figure out which events you need by turning them all off and
then enabling the ones you need. By default 4D enables a lot of form
events. It's a holdover from the ancient event scheme of
Before/During/After from a long time ago. As a default they want a form or
object to behave more or less like one did back then. And that's OK I
suppose but it leads to cases of developer FE-FOMO (form event-fear of
missing out). That is, fear that by turning off events our forms will
somehow stop working.

I argue to look at it the other way - start blank and enable the events you
actually need to accomplish the form's goal. On load is almost always a
good idea on a form. I usually prefer to initialize all my form objects
from the form method rather than enable On load for individual form
objects. Just a preference. So I generally don't enable On load for form
objects. For buttons, lists and such it's On click unless I'm being fancy
with something like On drop. That's pretty much it unless I have a specific
need in which case I enable what I need - On timer, On resize, and so on.

The form itself usually gets On load, On clicked, On outside call, On data
change, On loosing focus. That will cover you most of the time. The form
method might look like this:

Case of

:(Form event = On Load) //  initialize, load lists etc.


:(Form event = On outside call) //  respond


End case

//  this code will run for every event enabled on the form

//  I use this area for code to manage the look and state of form objects

OBJECT SET VISIBLE(*;"someObject_@";$visible)
OBJECT SET ENTERABLE(*;"someObject_@";$enterable)


From there turn on what you need and update the code to accommodate it. I
like to do things like manage form objects visible, enabled, enterable
settings after evaluating the specific event but that's my preference and
style. That's why I have things like On clicked and On loosing focus
enabled on the form but don't specifically evaluate them in the form method
(or enable them on the form objects) - they trigger updates of the form
display in response to whatever the user might have done.

Final thing to remember is enabling an event on a form isn't required to
enable it on an object. And enabling an event on a object doesn't cause the
form to respond to it.

On Fri, Nov 17, 2017 at 7:31 AM, Jim Medlen via 4D_Tech <
[email protected]> wrote:

> What is the best Form Event to use with a Drop Down Menus on a form ?
>
> Is it better to use On Clicked or On Data Change ?
>
> Does On Clicked cause multiple form events when used with a Drop down Menu
> ?
> (when opening the menu and when selecting a choice from the menu)
>

-- 
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]
**********************************************************************

Reply via email to