Discussion:
Selection Changed Programmatically (How to trigger form event?)
Jeremy French
2017-02-08 14:46:16 UTC
Permalink
When programmatically changing the selection (in a listbox or Write Pro area, for example), is there a way to generate an "On Selection Change" form event for the object whose selection changed?

For example, assume:

1) Array Listbox
2) "On Selection Change" event check-marked
3) Listbox displaying multiple rows

Then a button object method executes the following:
--
GOTO OBJECT(*;"edit_listboxA")
LISTBOX SELECT ROW(*;"edit_listboxA";1;lk replace selection)
--

QUESTION --- Is it possible to get the listbox's "On Selection Change" form event to trigger, after programmatically changing the listbox's selection?

Using:
v16R2
**********************************************************************
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:4D_Tech-***@lists.4D.com
*************************************************
Chip Scheide
2017-02-08 15:25:27 UTC
Permalink
If the event doesn't fire automatically, I am not aware of anyway to
get it fire.
However, if you use a coding structure like the following, you can
'fake it', then you can 'trigger' a form event by simply calling the
method with the desired form event.

do stuff to change selection
lstbox_Manager(On Selection Change)

where, lstbox_Manager is a method called by the listbox with the form
event as a parameter, and the following fake code gives you an idea of
what the lstbox_Manager might do.

Lstbox_Manager
$Form_Event:=$1
case of
:($Form_event= ON Double Clicked)
do stuff
:($Form_event= ON Drag Over)
do drop validation

:($Form_event= ON Drop)
add dropped data to listbox
lstbox_Manager(On Selection Change)

:($Form_Event= On Selection Change)
Do related record loading (or whatever)
end case
Post by Jeremy French
When programmatically changing the selection (in a listbox or Write
Pro area, for example), is there a way to generate an "On Selection
Change" form event for the object whose selection changed?
1) Array Listbox
2) "On Selection Change" event check-marked
3) Listbox displaying multiple rows
--
GOTO OBJECT(*;"edit_listboxA")
LISTBOX SELECT ROW(*;"edit_listboxA";1;lk replace selection)
--
QUESTION --- Is it possible to get the listbox's "On Selection
Change" form event to trigger, after programmatically changing the
listbox's selection?
v16R2
**********************************************************************
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
**********************************************************************
---------------
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing
**********************************************************************
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:4D_Tech-***@lists.4D.com
***************************

Loading...