🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages Started by Dan Tue, 24 Apr 2007 14:08
WindowState = wsMaximized
#2188
Author: Dan
Date: Tue, 24 Apr 2007 14:08
13 lines
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
#2190
Author: Vladimir Stefanovic
Date: Tue, 24 Apr 2007 15:51
35 lines
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
#2194
Author: Dan
Date: Tue, 24 Apr 2007 20:20
5 lines
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