[Lazarus] Form event

Antonio Fortuny a.fortuny at sitasoftware.lu
Wed Feb 20 11:01:57 CET 2013



Le 19/02/2013 19:34, Hans-Peter Diettrich a écrit :
> Antonio Fortuny schrieb:
>> Hi folks.
>>
>> Do you know an event or any other trick I could use when a form
>> re-gains control, i.e. is focused again ?
>> Events OnShow, OnActivate fire only once after OnCreate.
>
> These were my candiates as well.
>
>> The form is brought to the foreground by the means of a
>> MyForm.BringToFront once a OtherForm.ShowModal returns. The reason is
>> because the WindowsCE forms stack control seems to be rubbish.
>
> Sorry, I don't know how WinCE behaves in this case.
Very simple: when yo exit a modal displayed form you are not always sure 
to have on the screen the form which displayed the closed one. That's 
why I guess that forms stack is not very well managed
  But when ShowModal
> returns, you can do whatever is needed - e.g. invoke FormActivate or
> whatever handler contains your specific code.
Yes, but the problem is that this main form shows two dozens of other 
forms ! It's easy to gain control after ShowModal returns but the code 
has to be repeated as many times as ther are forms to process.
>
>> The form I want to manage control is also the main form of the program.
>
> In a Delphi program I send the main form user-defined messages, whenever
> certain informations have been changed by other code and must be
> reflected in my main form.
I'm used to send messsages as well. Again, it supposes the (almost) same 
code to be reproduced for every form.
>
> DoDi
>
I think I'm going to implement a timer wich will periodically launch the 
code. I'll just disable it on places where the program must not be 
interrupted. In my mind I was thinking to use those moments where the 
operator comes back to the main menu to start another operation which 
ensures that nothing else important is guing on, like one form event
Thanks anyway
I think






More information about the Lazarus mailing list