Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-02

Form event

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Antonio Fortuny

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. 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. The form I want to manage control is also the main form of the program.

Thanks,
Antonio.

Reply by email

Bob Hofman
to Antonio Fortuny

It depends on what you want to do with Form1 while Form2 is showing. You can put a line in Form2's OnActivate event to bring Form1 to the front but you will not be able to do anything in Form1 until Form2 is closed.

Cheers.

Bob

Antonio Fortuny wrote 21 lines
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. 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. The form I want to manage control is also the main form of the program. Thanks, Antonio. -- ______________________________**_________________ Lazarus mailing list .**freepascal.org http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130219/a311de73/attachment.html>

Reply by email

Hans-Peter Diettrich
to Antonio Fortuny: Hi folks. Do you know an event or any other trick I could use when a form re-gains…
Show quoted text 5 lines
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. But when ShowModal returns, you can do whatever is needed - e.g. invoke FormActivate or whatever handler contains your specific code.

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.

DoDi

Reply by email

Antonio Fortuny
to Hans-Peter Diettrich

Le 19/02/2013 19:34, Hans-Peter Diettrich a ?crit :

Show quoted text 14 lines
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.

Show quoted text 6 lines
> 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

Reply by email

Hans-Peter Diettrich
to Antonio Fortuny
Show quoted text 20 lines
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

These are two problems. One is the Z order maintenance, and another one which messages are sent. I only know from working on one program (C++), that WinCE differs from traditional Windows behaviour.

Show quoted text 6 lines
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.

AFAIR the LCL maintains a forms list in Z order (Application.Forms?), which may be useful to establish the wanted Z order.

DoDi

Reply by email

Antonio Fortuny
to Hans-Peter Diettrich

Le 20/02/2013 11:36, Hans-Peter Diettrich a ?crit :

Show quoted text 25 lines
Antonio Fortuny schrieb: > > > 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 These are two problems. One is the Z order maintenance, and another one which messages are sent. I only know from working on one program (C++), that WinCE differs from traditional Windows behaviour.

I can aknowledge. This strange behaviour is what we see. This the reason why on ShowModal return a Self.BringToFront is performed and Z order stack problems are solved

Show quoted text 20 lines
> 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. AFAIR the LCL maintains a forms list in Z order (Application.Forms?), which may be useful to establish the wanted Z order. DoDi -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email