🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2048

Re: WindowState = wsMaximized

#2048
From: Vladimir Stefanovic
Date: Wed, 25 Apr 2007 08:53
69 lines
2805 bytes
Dan <Dan@do.not.spam> wrote:
>
>> Do you have some dialogs in OnActivate or similar?
>OnActivate definitely did the trick.
>
>Thanks

Deciding whether or not to set wsMaximized WindowState at
run-time can make some weird problems when you extend your
app with some new features, like showing startup dialogs 
(licensing systems, tips of the day, etc...). This is what
I have faced with few years ago:

--- Problem 1 ---

__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
   // Eg: I read Config and decided to open app maximized
   WindowState = wsMaximized;
}
void __fastcall TForm1::FormActivate(TObject *Sender)
{
   ShowMessage( "This message box mimics any dialog, eg. Licensing System" );
}

If you try the simple code (below), you'll see very weird 
visual effect.

The even more weird effect you'll see if you have a Panel
on the main form, which is aligned alClinet, and has to be
invisible during startup:


--- Problem 2 ---

__fastcall TForm1::TForm1(TComponent* Owner) // same as in Problem 1
        : TForm(Owner)
{
   WindowState = wsMaximized;
}
void __fastcall TForm1::FormActivate(TObject *Sender)
{
   Panel1->Visible = false; // aligned alClient
   ShowMessage( "This message box mimics any dialog, eg. Licensing System" );
   Panel1->Visible = true;
}

And that's the main reason I moved all dialogs to the most
unusual place, when I want to initiate the startup dialogs.
That't OnPaint() event:

void __fastcall TForm1::FormPaint(TObject *Sender)
{
   static bool HasPassedOnceOnPaint = false;
   if ( ! HasPassedOnceOnPaint )
   {
      HasPassedOnceOnPaint = true;
      ShowMessage( "This message box mimics any dialog, eg. Licensing System" );
   }
}

Then WindowState = wsMaximized assigned at run-time works well
without any issues known to me.


Best Regards,
Vladimir Stefanovic
Technical Details
Message-ID: <462f16f5$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <462e1003$1@newsgroups.borland.com> <462e278d@newsgroups.borland.com> <462e6724$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,8a1d45dff409ee34
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Vladimir Stefanovic" <antivari@sbb.co.yu>
Sender: "Vladimir Stefanovic" <antivari@sbb.co.yu>
Reply-To: "Vladimir Stefanovic" <antivari@sbb.co.yu>
Subject: Re: WindowState = wsMaximized
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 195.252.72.241     
X-Forwarded-For: 192.168.129.132
References: <462e1003$1@newsgroups.borland.com> <462e278d@newsgroups.borland.com> <462e6724$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <462f16f5$1@newsgroups.borland.com>
Date: 25 Apr 2007 01:53:09 -0700
X-Trace: newsgroups.borland.com 1177491189 207.105.83.66 (25 Apr 2007 01:53:09 -0700)
Lines: 70
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail