Article View: borland.public.cppbuilder.nativeapi
Article #16503Re: BorderIcon Question
From: Jim
Date: Sun, 11 May 2003 17:54
Date: Sun, 11 May 2003 17:54
93 lines
5033 bytes
5033 bytes
The reason all of this came about is because I need to have the maximize
button enabled. (Originally the program had this button not enabled and the
notebook that makes up a majority of this program has many activepages that
all have their dimensions predifined.) Now I have each ActivePage check the
WindowState to see if the program has been maximized, and if so it keeps the
ActivePage maximized and if not it uses the original predifined dimensions.
The problem that has arisen is that when the user presses the Restore Down
button now the program can be on any number of the Notebooks ActivePages and
it resizes to the predifined size of whatever sized page it was on when it
was maximized, which usually has a different predifined dimension than the
actual page that they are on.
So, I need to check when they press the Restore Down button to see which
ActivePage they are on, and then set the Hieght and Width to the size that I
need for that ActivePage. Since I am still pretty new to all of this I
usually have trouble understanding the more technical .hlp files, but I am
looking through there at what I can find out about the WindowProc and
anything else pertaining to catching when one of these BorderIcon buttons
are being used and catching it so I can run a function when the Restore Down
is used.
Thanks for your time.
~ Jim
"JD" <nospam@nospam.com> wrote in message
news:3ebe5dda$1@newsgroups.borland.com...
>
> "Jim" <junk1@imperialstar.com> wrote:
> > It is mandatory that I run a function whenever the user
> > clicks on the BorderIcon Restore Down button.
>
> You are aware that the BorderIcon isn't the only way for the user to
restore down right? What exactly are your requirements for executing the
function?
>
> If the forms BorderStyle is bsSingle for a non-sizable form (user can not
drag the border to resize the form) you can handle the function with the
forms OnResize event by checking the forms WindowState property.
>
> If the function is executed only when the user clicks the BorderIcon, the
first thing that you have to do is subclass the forms WindowProc so that you
can recieve notice of when the button is clicked:
>
> // in header
> private: // User declarations
> TWndMethod OldWindowProc;
> void __fastcall NewWindowProc( TMessage& );
> public: // User declarations
> __fastcall TForm1(TComponent* Owner);
> __fastcall TForm1::~TForm1();
> };
> //-------------------------------------------------
> __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
> {
> OldWindowProc = WindowProc;
> WindowProc = NewWindowProc;
> }
> //-------------------------------------------------
> __fastcall TForm1::~TForm1()
> {
> WindowProc = OldWindowProc;
> }
> //-------------------------------------------------
> void __fastcall TForm2::NewWindowProc( TMessage& Message )
> {
> switch( Message.Msg )
> {
> // test here for your manditory function
> // you'll need to decide what message you'll
> // test for. You could look only for WM_NCLBUTTONUP
> // and determine if the click release was in the Restore
> // down button but I think that there is a better message
> // available to test for. Look at the win32.hlp file
> // If you process the message yourself (don't want the
> // restore down to happen) set Message.Result to the value
> // indicated in the help file for the selected message
> // if the help says to set the result. if you are only
> // going to add to the restore down functionality, then
> // be sure to call the old WindowProc before or after you
> // perform your function.
> case WM_NCLBUTTONDOWN:
> case WM_NCLBUTTONUP:
> case WM_SIZE:
> case WM_SIZING:
> default: OldWindowProc( Message );
> }
> }
> //-------------------------------------------------
>
> ~ JD
>
Technical Details
Message-ID:
<3ebe8e58@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3ebe3c36@newsgroups.borland.com> <3ebe5dda$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,75b9b16b9fc71b77 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-05-11 10:56:10 PST From: "Jim" <junk1@imperialstar.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3ebe3c36@newsgroups.borland.com> <3ebe5dda$1@newsgroups.borland.com> Subject: Re: BorderIcon Question Date: Sun, 11 May 2003 11:54:15 -0600 Lines: 95 Organization: Imperial Star Enterprises X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 172.195.168.189 Message-ID: <3ebe8e58@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1052675672 172.195.168.189 (11 May 2003 10:54:32 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail