Board index » cppbuilder » How to close Form in OnShow ?
Joerg Gaid
![]() CBuilder Developer |
Tue, 17 Sep 2002 03:00:00 GMT
|
Joerg Gaid
![]() CBuilder Developer |
Tue, 17 Sep 2002 03:00:00 GMT
How to close Form in OnShow ?
Hello everybody,
can someone please give me a method to close a form in the OnShow event, and the possibility to run after this in the OnClose or OnDestroy or deconstuctor method. I tried it with cause an exeception but it didn't work because it skiped the OnClose, OnDestroy and deconstuctor methods. Thank you |
Tolga Balc
![]() CBuilder Developer |
Tue, 17 Sep 2002 03:00:00 GMT
Re:How to close Form in OnShow ?Quote> can someone please give me a method to close a form in the OnShow event, I take it you've tried this and you are still having problems. Can you give a For example the following code works: void __fastcall TForm1::FormShow(TObject *Sender) Quote} void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action) Quote} The Form never shows up and all you get to see is a message saying "Closing". - Tolga Quote"Joerg Gaide" <joerg.ga...@metronet.de> wrote in message <snip> |
J?rg Gaid
![]() CBuilder Developer |
Thu, 19 Sep 2002 04:00:00 GMT
Re:How to close Form in OnShow ?Hello Tolga, your tip works if my form is the main form of the application, but it failed when a second form is opened from the main form. The second form is shown and the Close()-command in FormShow() has no effect. The FormClose() method isn't called. Perhaps you have a solution of this problem ? Use your code in the second form and call Form2->ShowModal() from the first Form and you will see the problem. I'm using C++Builder 5. Thank you Tolga. Tolga Balci schrieb: Quote
|
Mark Finkl
![]() CBuilder Developer |
Thu, 19 Sep 2002 04:00:00 GMT
Re:How to close Form in OnShow ?You could do a PostMessage to send a WM_QUIT message to the application. This should convince the application to shut down as soon as possible. QuoteJ?rg Gaide <joerg.ga...@metronet.de> wrote in message <snip> |
Tolga Balc
![]() CBuilder Developer |
Sat, 21 Sep 2002 03:00:00 GMT
Re:How to close Form in OnShow ?Hello J?rg! Now I see what you mean ! :O) Quote>Perhaps you have a solution of this problem ? Instead capturing the OnShow event override the Show method instead: class TForm2 : public TForm Quote}; { if( Whatever ) TForm::Show(); Quote} This way you can control if your form actually shows as requested or not. ( Call But ofcourse since the form never shows in the above method you won't recieve a void __fastcall TForm2::Show( void ) Quote} or void __fastcall TForm2::Show( void ) Quote} I know this is not exactly what you were asking for, but hope it still helps. - Tolga Quote"J?rg Gaide" <joerg.ga...@metronet.de> wrote in message <snip> |
Joerg Gaid
![]() CBuilder Developer |
Sat, 12 Oct 2002 03:00:00 GMT
Re:How to close Form in OnShow ?Hello Tolga, i'am sorry for late response, i was away on business. Your tip works great. Thank you. J?rg Tolga Balci schrieb: Quote
|
1. Trying to close Form in OnShow does not work - why
2. Close form from OnShow or OnActivate event?
4. Closing modal form in onshow
6. Close a form in the OnShow event
7. Close form from OnShow (BCB3)
8. Hiding form in form.Onshow ??
9. Novice in Need-freeing a form from another form's OnShow event
10. ** Can I close the prior form without close second form ?**