Chris Belanger:

> 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’.

Hi Chris,

I solve things like that with a Form.update property.
Whenever something gets "dirty" I set Form.update:=true and at the end of my 
Form method I have the code that updates all the dirty stuff.

Example:

case of
  :(form event= on load)
  ...
  Form.update:=true

  :(form event=on clicked)
  ...
  more event-cases here...
end case

if(Form.update)
   Form.update:=false
   ... do the necessary updating here
end if

In any button script that changes the City or Province in your example just add 
Form.update:=true

Works great, except of course for those cases where objects like listboxes are 
not fully initialized at the end of "on load".
Still need the timer clutch for that.

Greetings from Germany,
Bernd Fröhlich
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to