Yes, with your sample code I managed to reproduce your problem.

I suspect the problem is that fsStayOnTop is 
modifying some underlying Delphi runtime data 
structures and causing problems.  If I move 
"FormStyle := fsStayOnTop" to the OnCreate event, the form works fine.

In fact, Delphi Help for "FormStyle property 
(TCustomForm)" says "Note: It is not advisable to 
change FormStyle at runtime.".  This leads me to 
think that FormStyle is a "delicate" property and 
you may need to rearrange the order of your code to get it to run correctly.


At 12:44 AM 5/10/2009, Cédric Joubert wrote:
>hi,
>
>Thanks to you to look at my problem !
>
>Oups sorry...:-)  it is just because you need a main form (let's call it
>FormMain) calling the Form1 with a Show instruction (not Showodal) from a
>Button (let's call it ButtonMain) on the Main Form. But take a look at the
>source here if you want :
>http://www.crawleyscastingcalls.com/temp/test/
>
>and yes, you're right it is TForm1 (not TForm2).
>
>So i my example, because of the Stay on Top Form1 above the FormMain form,
>the Form1.Deactivate event is fired each time you click on the Button1, or
>when you click on the FormMain form which is below Form1.
>
>I work under XP (sp2) with D7.
>
>Cédric
>
>----- Original Message -----
>From: "Sid Gudes" <[email protected]>
>To: "Borland's Delphi Discussion List" <[email protected]>
>Sent: Saturday, May 09, 2009 5:37 PM
>Subject: Re: Problem refreshing Memo of a Form
>
>
>I created a small project that has these
>components and it worked fine in D7 under XP;
>which version are you using?  I note that your
>OnClick below refereces Tform1, but your
>OnDeactivate references Tform2.  Perhaps the code
>below doesn't reflect all the code in your project?
>
>Also, since the form is change to StayOnTop, the
>OnDeactivate event never gets fired...
>
>
>At 02:20 AM 5/9/2009, Cédric Joubert wrote:
> >hi,
> >
> >I have a simple question about repainting
> >controls in a form but this example is maybe simpler to ask my question :
> >
> >I have a form with 1 TButton, 1 TEdit and 1 TMemo.
> >
> >     the text 'Edit1' is displayed in TEdit.text
> >     the text 'Memo1' is displayed in the first line of TMemo
> >
> >In my code Button1.OnClick i have just 2 lines :
> >
> >procedure TForm1.Button1Click(Sender: TObject);
> >begin
> >   FormStyle := fsNormal;
> >   FormStyle := fsStayOnTop;
> >end;
> >
> >In my TForm.OnDeactivate i have just this line :
> >
> >procedure TForm2.FormDeactivate(Sender: TObject);
> >begin
> >   Memo1.Lines.Add('deactivate');
> >end;
> >
> >
> >Question : when i launch my form I see the 2
> >text "Edit1" and "Memo1" correctly displayed.
> >Then when I click on the button, the "Edit1"
> >text stay right displayed in TEdit
> >but the text of TMemo is erased, why ?
> >
> >TEdit and TMemo have exactly the same priciapl
> >heritance hierarchy...(TWincontrol... TPersistent...).
> >
> >Anyone can help me ?
> >
> >Cédric
> >
> >
> >_______________________________________________
> >Delphi mailing list -> [email protected]
> >http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>
>Regards,
>Sid Gudes
>PIA Systems Corporation
>[email protected]
>
>
>_______________________________________________
>Delphi mailing list -> [email protected]
>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>
>_______________________________________________
>Delphi mailing list -> [email protected]
>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Regards,
Sid Gudes
PIA Systems Corporation
[email protected] 


_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to