Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages
Started by Dan
Tue, 24 Apr 2007 14:08
WindowState = wsMaximized
Author: Dan
Date: Tue, 24 Apr 2007 14:08
Date: Tue, 24 Apr 2007 14:08
13 lines
1491 bytes
1491 bytes
Hi, in design mode, I like my form to be a specific size, typically the size of the most common user's screen (mine is much larger in resolution). However, when the program runs, I want the form to show up maximized and unmoveable (unless the user presses the restore window button in the upper left). I have added WindowState = wsMaximized to the OnShow() event, which does look like the form is maximized (the maximize button is disabled and the other is not) however, the form is movable. I can restore the size of the app and then click the maximize button and then the form is maximized and unmovable. How do I mimic that operation in some startup code, line OnShow?
Re: WindowState = wsMaximized
Author: Vladimir Stefanovic
Date: Tue, 24 Apr 2007 15:51
Date: Tue, 24 Apr 2007 15:51
35 lines
1895 bytes
1895 bytes
> I have added WindowState = wsMaximized to the OnShow()
> event,
OnShow() is not the best place for that. Move that code in the
Constructor insted.
> which does look like the form is maximized (the maximize
> button is disabled and the other is not) however, the form is
> movable. I can restore the size of the app and then click the
> maximize button and then the form is maximized and unmovable.
> How do I mimic that operation in some startup code, line
> OnShow?
Do you have some dialogs in OnActivate or similar?
Also, note that OnShow and OnActivate can be exectuted more
that once, so you need some additional code like this, to avoid
multiple execution ofsome parts of code:
void __fastcall TForm1::FormShow(TObject *Sender)
{
static bool HasPassedOnceOnShow = false;
if ( ! HasPassedOnceOnShow )
{
HasPassedOnceOnShow = true;
WindowState = wsMaximized
}
}
--
Best Regards,
Vladimir Stefanovic
Re: WindowState = wsMaximized
Author: Dan
Date: Tue, 24 Apr 2007 20:20
Date: Tue, 24 Apr 2007 20:20
5 lines
1008 bytes
1008 bytes
> Do you have some dialogs in OnActivate or similar? OnActivate definitely did the trick. Thanks
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads