 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Safwan Guest
|
Posted: Wed May 17, 2006 7:14 am Post subject: PopupMode and application focus |
|
|
Hi
It is a strange problem !!
I have this scenario.
Create an application, Form1 is the main form. I did not cahnge any
properies for this form.
Create a new form (Form2), - not in auto-create forms -, set the PopupMode
to pmAuto.
Put a button on the main form with :
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Form2 = new TForm2 (Form1);
Form2->Show ();
}
On the Form2, put a button with :
void __fastcall TForm2::Button1Click(TObject *Sender)
{
ShowMessage ("Hi");
}
And set CloseAction for Form2 to caFree.
void __fastcall TForm2::FormClose(TObject *Sender, TCloseAction &Action)
{
Action = caFree;
}
Now, Run the program and click on the button in main form and click on the
button in form2, then close the form2. -- The application will lost focus --
Any one explain the matter. |
|
| Back to top |
|
 |
Safwan Guest
|
Posted: Sat May 20, 2006 7:14 pm Post subject: Re: PopupMode and application focus |
|
|
Hi all
I have post the message before days, and I try to solve the problem in any
way, at last I solve it by add a line to the FormClose, and it look like
this :
void __fastcall TForm2::FormClose(TObject *Sender, TCloseAction &Action)
{
Action = caFree;
Application->MainForm->SetFocus(); // new line.
}
Do you have any explanation ?
Thank.
-----------------------------------
"Safwan" <safwan_maswadeh (AT) yahoo (DOT) com> wrote in message
news:446ac262 (AT) newsgroups (DOT) borland.com...
| Quote: | Hi
It is a strange problem !!
I have this scenario.
Create an application, Form1 is the main form. I did not cahnge any
properies for this form.
Create a new form (Form2), - not in auto-create forms -, set the PopupMode
to pmAuto.
Put a button on the main form with :
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Form2 = new TForm2 (Form1);
Form2->Show ();
}
On the Form2, put a button with :
void __fastcall TForm2::Button1Click(TObject *Sender)
{
ShowMessage ("Hi");
}
And set CloseAction for Form2 to caFree.
void __fastcall TForm2::FormClose(TObject *Sender, TCloseAction &Action)
{
Action = caFree;
}
Now, Run the program and click on the button in main form and click on the
button in form2, then close the form2. -- The application will lost
focus --
Any one explain the matter.
|
|
|
| Back to top |
|
 |
Michel Leunen Guest
|
Posted: Sat May 20, 2006 9:14 pm Post subject: Re: PopupMode and application focus |
|
|
Safwan wrote:
| Quote: | I have post the message before days, and I try to solve the problem in any
way, at last I solve it by add a line to the FormClose, and it look like
this :
void __fastcall TForm2::FormClose(TObject *Sender, TCloseAction &Action)
{
Action = caFree;
Application->MainForm->SetFocus(); // new line.
}
Do you have any explanation ?
|
Nope, I can reproduce this behaviour. Seems to be a bug for me but, as
you stated, the workaround is obvious, though.
You should report it to QC.
Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
http://www.leunen.com/
---------------------------------------- |
|
| Back to top |
|
 |
Michel Leunen Guest
|
Posted: Sun May 21, 2006 10:14 am Post subject: Re: PopupMode and application focus |
|
|
Michel Leunen wrote:
| Quote: | Seems to be a bug for me
|
Hmm, thinking a little bit more about it, I don't think it's a bug.
You didn't set the Parent property of your form. If you set it to Form1,
your application doesn't lose focus anymore.
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Form2 = new TForm2 (Form1);
Form2->Parent = Form1;
Form2->Show ();
}
Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
http://www.leunen.com/
---------------------------------------- |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|