Thread View: borland.public.cppbuilder.nativeapi
5 messages
5 total messages
Started by bar
Sat, 09 Feb 2008 11:32
Form Move
Author: bar
Date: Sat, 09 Feb 2008 11:32
Date: Sat, 09 Feb 2008 11:32
8 lines
1069 bytes
1069 bytes
Hello all One quick question Is there any way to know, just before a form is moving. I need to perform some action before a form is moved from its last place. Thanks SA
Re: Form Move
Author: Asger Joergensen
Date: Sat, 09 Feb 2008 14:10
Date: Sat, 09 Feb 2008 14:10
41 lines
1633 bytes
1633 bytes
Hi bar
bar says:
> Hello all
> One quick question
>
> Is there any way to know, just before a form is moving.
> I need to perform some action before a form is moved from its last place.
>
> Thanks
> SA
in the class:
void __fastcall WMWindowPosChanging(TMessage& Msg);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_WINDOWPOSCHANGING, TMessage, WMWindowPosChanging)
END_MESSAGE_MAP(TForm)
int the cpp file:
void __fastcall TForm1::WMWindowPosChanging(TMessage& Msg)
{
TForm::Dispatch((void*)&Msg);
LPWINDOWPOS LpWp = (LPWINDOWPOS)Msg.LParam;
//LpWp->cx;
//LpWp->cy;
}
//-------------------------------------------------------
or You can overide the SetBounds:
virtual void __fastcall SetBounds(int L, int T, int W, int H);
Kind regards
Asger
Re: Form Move
Author: bar
Date: Sat, 09 Feb 2008 15:35
Date: Sat, 09 Feb 2008 15:35
5 lines
955 bytes
955 bytes
Hi Asger Thanks i'll try Regards SA
Re: Form Move
Author: bar
Date: Sun, 10 Feb 2008 15:49
Date: Sun, 10 Feb 2008 15:49
10 lines
1182 bytes
1182 bytes
Hi asger I used your code But when the first time i am getting a exception Can not change the Visible on OnShow and OnHide Any idea how to handle this. Regards SA
Re: Form Move
Author: Asger Joergensen
Date: Sun, 10 Feb 2008 16:18
Date: Sun, 10 Feb 2008 16:18
32 lines
1828 bytes
1828 bytes
Hi bar bar says: > Hi asger > > I used your code > But when the first time i am getting a exception > > Can not change the Visible on OnShow and OnHide > > Any idea how to handle this. It is very difficult to answer such a question without seing Your code so please show the code You are using. There is nothing in the code I wrote that gives that exception. But if You are doing something with visible as responce to that message You need to make sure that the form is finished creating. You can set a bool in the form show event and then chek it in the message or You can check the ComponentState to make sure that the form is created. You can also check the Parent property if that is NULL don't do anything. if You want to adjust the size or pos of the form You shuld chage the the values in the WINDOWPOS structure and not use the properties of the form. Kind regards Asger
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