form.OnActive := nil;
 Avoid the if statement and the call to the event.

 On 9/12/05, Robert Meek <[EMAIL PROTECTED]> wrote: 
> 
> I hope you read my follow-up message otherwise the code you add to
> your form's OnActivate will run every time it is activated, and depending
> upon how you have Windows setup that can be as often as everytime your 
> mouse
> cursor passes over the form! Add a Boolean variable to the implementation
> section of the form, something like 'FirstActivate' and set it to True in
> your Form's OnCreate. Then in your Form's OnAcytivate event, wrap the code
> you want to run inside an If...Then statement like so:
> 
> If FirstActivate = True then
> Begin
> Special code goes here
> FirstActivate := False;
> End;
> 
> This way the code inside it will only run once!
> 
> from: Robert Meek at: [EMAIL PROTECTED]
> dba "Tangentals Design" home of "PoBoy"
> freeware Windows apps and utilities
> located at: www.TangentalsDesign.com <http://www.TangentalsDesign.com>
> Proud to be a moderotor for the
> "Delphi Programming Lists" at: elists.org <http://elists.org>
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
> Behalf
> Of Rainer von Saleski
> Sent: Monday, September 12, 2005 8:20 AM
> To: Borland's Delphi Discussion List
> Subject: Re: A form that runs when Shown, with no user action
> 
> Thank you! OnActivate is just what I was looking for ... it works great.
> 
> I had considered putting the guts of the code in the calling form, but 
> that
> would have put two main subsections in the program's main form ... hardly
> good structured programming technique, and hard to maintain.
> 
> Does anyone know of a concise chart or diagram of how the different events
> are invoked during form execution? I would have expected to find this in
> the manual, but I cannot.
> 
> Thanks,
> Rainer
> 
> 
> ----- Original Message -----
> From: "Robert Meek" <[EMAIL PROTECTED]>
> To: "'Borland's Delphi Discussion List'" <[email protected]>
> Sent: Sunday, September 11, 2005 10:27 PM
> Subject: RE: A form that runs when Shown, with no user action
> 
> 
> Yes you're right! I forgot to mention that I also add a Boolean var
> set to False when the app starts, or the form is created, and then set it 
> to
> true when activated the first time. After that any code in the activate
> won't run again.
> 
> from: Robert Meek at: [EMAIL PROTECTED]
> dba "Tangentals Design" home of "PoBoy"
> freeware Windows apps and utilities
> located at: www.TangentalsDesign.com <http://www.TangentalsDesign.com>
> Proud to be a moderotor for the
> "Delphi Programming Lists" at: elists.org <http://elists.org>
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
> Behalf
> Of Glen Thompson
> Sent: Sunday, September 11, 2005 9:27 AM
> To: Borland's Delphi Discussion List
> Subject: RE: A form that runs when Shown, with no user action
> 
> OnActivate is useful but be careful that it may be fired
> repeatedly if the user clicks away from the form and back again.
> Check this behaviour. You may want to prevent the form
> getting focus from the mouse etc and activate it only
> programmatically. (OTTOMH)
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Robert Meek
> Sent: Sunday, 11 September 2005 6:40 PM
> To: 'Borland's Delphi Discussion List'
> Subject: RE: A form that runs when Shown, with no user action
> 
> 
> Use the Form's OnActivate event, and in your Form's OnShow you may
> also have to add a call to YourForm.Setfocus.
> 
> from: Robert Meek at: [EMAIL PROTECTED]
> dba "Tangentals Design" home of "PoBoy"
> freeware Windows apps and utilities
> located at: www.TangentalsDesign.com <http://www.TangentalsDesign.com>
> Proud to be a moderotor for the
> "Delphi Programming Lists" at: elists.org <http://elists.org>
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
> Behalf
> Of Rainer von Saleski
> Sent: Saturday, September 10, 2005 5:06 PM
> To: Borland's Delphi Discussion List
> Subject: A form that runs when Shown, with no user action
> 
> How do I go about having a form that "runs" (does something) when Shown,
> with no additional user action (beyond that which caused to form to be
> shown)?
> 
> When I put my action code inside the OnShow event handler, the form does 
> not
> actually display until the actions are complete. But I want to keep the
> user informed during the 60 seconds or so it takes to do the action
> (compress a bunch of files into a ZIP file and email it).
> 
> This happens at the end of a chain of other events, and if I make the user
> press a "Run" button after the form is displayed, half the time the users
> forget to press it, and the backup files never get sent.
> 
> There must be a simple answer ...
> 
> Thanks,
> Rainer
> _______________________________________________
> Delphi mailing list -> [email protected]
> http://www.elists.org/mailman/listinfo/delphi
> 
> _______________________________________________
> Delphi mailing list -> [email protected]
> http://www.elists.org/mailman/listinfo/delphi
> 
> 
> _______________________________________________
> Delphi mailing list -> [email protected]
> http://www.elists.org/mailman/listinfo/delphi
> 
> 
> 
> _______________________________________________
> Delphi mailing list -> [email protected]
> http://www.elists.org/mailman/listinfo/delphi
> 
> _______________________________________________
> Delphi mailing list -> [email protected]
> http://www.elists.org/mailman/listinfo/delphi
>
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to