Board index » cppbuilder » TForm behaviour

TForm behaviour

I'm not sure if this should be posted to the .upgrade newsgroup, but
here goes:

I am (belatedly) porting an application from CBuilder3 to CBuilder5.
In CBuilder5 (but not in CBuilder3), I notice that when the properties
of some objects in MDI child forms are changed from another form
(other than the Main Form), focus jumps from that other form to the
Main Form.  For example, this code in modeless Form1

MDIChild1->TrackBar1->Enabled = false;

forces focus to MDIChild1.  I can get around this by executing

Form1->SetFocus();

in the FormActivate() handler of MDIChild1.  However, you can see the
Main Form briefly before Form1 is redrawn.  Is there another way to
deal with this that doesn't allow the focus to change at all, even
briefly?

Thanks,

Jon G.

 

Re:TForm behaviour


Use the following:

LockWindowUpdate(Main Form Handle);
Your code here that leads to visual disturbances you don't want users to
see.
LockWindowUpdate(0);

Kevin Berry
kevinbe...@charter.net

Quote
Jon Gabel <jonga...@dnai.com> wrote in message news:3b5e21bd_2@dnews...
> I'm not sure if this should be posted to the .upgrade newsgroup, but
> here goes:

> I am (belatedly) porting an application from CBuilder3 to CBuilder5.
> In CBuilder5 (but not in CBuilder3), I notice that when the properties
> of some objects in MDI child forms are changed from another form
> (other than the Main Form), focus jumps from that other form to the
> Main Form.  For example, this code in modeless Form1

> MDIChild1->TrackBar1->Enabled = false;

> forces focus to MDIChild1.  I can get around this by executing

> Form1->SetFocus();

> in the FormActivate() handler of MDIChild1.  However, you can see the
> Main Form briefly before Form1 is redrawn.  Is there another way to
> deal with this that doesn't allow the focus to change at all, even
> briefly?

> Thanks,

> Jon G.

Other Threads