Hi Kirk,

to explain what I want to have ‘custom events’ for, I think Justin Carr’s 
comment on this thread gives some good reason — to do processing after an  on 
LOAD that cannot be done during that event since many objects on the form do 
not exist at the time of on load.
In my efforts to create as generic of a system as possible (which OBJECTS help 
greatly in), some objects in a Form do not ‘exist’ during ON LOAD; but I need 
to initialize structures BEFORE the form starts operating and only at the 
initialization stage (on Load).

Once 4D **finally** makes it possible to programmatically get/set all the 
listBox properties in a collection/entity selection-based listbox (particularly 
data source, current item, current item position, selected items) then I would 
be in position to make use of that information in the custom event that would 
run immediately after ON LOAD (as Justin described).


Another use for it that I have not explored yet is to have a chunk of code that 
gets run under several different circumstances, but which I don’t want to make 
a dedicated Project Method for it.
I prefer to reduce the number of Project Methods while, of course, creating 
ones that make logical sense (as they can be called in several places in my 
code). But you understand that as a programmer.

One simple instance I want to experiment on — which, of course, is trivial, is:

I have three fields (actually object attributes)
City
Province (or State)
FullCityName

FullCityName is computed from City & Province
: (City = “”) —> FullCityName := “”
:(Province = “”) —> FullCityName := City
else
FullCityName := City + “, “ + Province

this same logic must be performed whenever City or Province changes.
So it could be cool to set it as a ‘custom event’ that is ’triggered’ by City 
and Province scripts. Naturally, it would have to take place at the end of 
those scripts so as not to encounter unexpected behaviors.

Now, it could be copy/pasted into both City & Province scripts; it could be 
made into a Project Method that gets called by either. Or it could be stuffed 
into the Form Method as a ’custom event’.

—— 
I realize I am potentially playing with fire, as the execution of code could be 
much different than one is expecting if they don’t keep on their toes. The 
custom event will be handled after the code it is called from has completed 
execution. So under many circumstances it would be a bad idea.

The example above is more of a ‘proof of concept’ for me.

— Chris



> On Apr 23, 2019, at 11:45 AM, Kirk Brooks via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Chris,
> Reading through your post and the replies I'm trying to think of what a
> 'custom event' would be. Can you give an example or two?
> 
> On Tue, Apr 23, 2019 at 7:33 AM Chris Belanger via 4D_Tech <
> 4d_tech@lists.4d.com> wrote:
> 
>> I am wondering if there is a way to configure Custom Form Events. I would
>> like to be able to post a form event, and have it then processed within the
>> FORM METHOD as such.
>> I am doing a lot of work in “Orda context” right now and can think of some
>> handy features that could be implemented in that way, especially with
>> keeping the number of project methods down (as code could be put into a
>> script instead).
>> Before you think “why would he want to do that?” — please just focus on
>> the question of ‘can I?’. :)
>> 
>> In the past, I used the form event “on Outside Call” stuff to handle
>> communications between processes, so I understand all that stuff.
>> 
>> I remember — but cannot find again — some documentation that talked about
>> using negative-numbered values for events to facilitate custom events.
>> However, I seem to remember it only was in the context of subforms.
>> 
>> Any help or direction you could provide would be most appreciated!
>> Thanks — Chris
>> **********************************************************************
>> 4D Internet Users Group (4D iNUG)
>> Archive:  http://lists.4d.com/archives.html
>> Options: https://lists.4d.com/mailman/options/4d_tech
>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>> **********************************************************************
> 
> 
> 
> -- 
> Kirk Brooks
> San Francisco, CA
> =======================
> 
> What can be said, can be said clearly,
> and what you can’t say, you should shut up about
> 
> *Wittgenstein and the Computer *
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to