Jump to content

Posting UM_ACTIVATED message cause subsequent showmessage() resart the FormActivae

Recommended Posts


Delphi Sydney.

I have a form,created once at application start.
The form contains 
     UM_ACTIVATED = WM_USER+1;  (I also tried WM_APP)
        procedure UMActivated(var Message: TMessage); message UM_ACTIVATED;
   FormActivate(Sender: Tobject);
     postMessage(Handle, UM_ACTIVATED, 0, 0);
   procedure UMActivated only sets some variables;
When the form is shown modal and then hidden (deactivated?) by Modalresult=MrOk, a subsequent showmessaage() call restarts the FormActivate of the form.
If I remove the postmessage(), everything works ok. 
Any sugestion on how to avoid this? In previous versions (non XE) this did not happen.
Thanks in advance

Share this post

Link to post

I found out why. I had the showmodal of the second form inside Formactivate of the first form.

I used a postmessage() in the Formactivate to open the 2nd form and that eliminated the problem.

I guess with the XE Delphi if the form activation was not completed, the screen.activeforms list was not 

restored to the 1st form because it had not been activated completely yet (the postmessage makes the 2nd form opening happen when the 1st form has completed its activation).


Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now