-
October 25th, 2010, 01:32 AM
#1
CSplitterWnd. How to catch separator move action?
How to catch separator move action?
-
October 25th, 2010, 01:37 AM
#2
Re: CSplitterWnd. How to catch separator move action?
Victor Nijegorodov
-
October 25th, 2010, 01:46 AM
#3
Re: CSplitterWnd. How to catch separator move action?
For recalculate what part of CSplitterWnd is each view and set views sizes when framewnd resized.
-
October 25th, 2010, 03:12 AM
#4
Re: CSplitterWnd. How to catch separator move action?
Victor Nijegorodov
-
October 25th, 2010, 04:02 AM
#5
Re: CSplitterWnd. How to catch separator move action?
I know how to set separator position. I need to catch separator position changed event.
I can call function from views OnSize functions, but I would like to use better solution.
-
October 25th, 2010, 04:28 AM
#6
Re: CSplitterWnd. How to catch separator move action?
Originally Posted by user008
I know how to set separator position. I need to catch separator position changed event.
There is no such "event"/message.
Handle WM_SIZE, then use CSplitterWnd::SetColumnInfo/SetRowInfo followed by CSplitterWnd::RecalcLayout
Victor Nijegorodov
-
October 25th, 2010, 05:00 AM
#7
Re: CSplitterWnd. How to catch separator move action?
Originally Posted by VictorN
There is no such "event"/message.
Handle WM_SIZE, then use CSplitterWnd::SetColumnInfo/SetRowInfo followed by CSplitterWnd::RecalcLayout
I try
Code:
BOOL CChildFrame::PreTranslateMessage(MSG *pMsg)
{
switch(pMsg->message)
{
case WM_SIZE:
MessageBox("");
break;
}
return CMDIChildWnd::PreTranslateMessage(pMsg);
But MessageBox appear only when window created. It does not work even when I resize window. What i did wrong?
-
October 25th, 2010, 05:04 AM
#8
Re: CSplitterWnd. How to catch separator move action?
What does PreTranslateMessage have to do with your splitter?
Why are you using it?
You have to directly handle WM_SIZE message!
Victor Nijegorodov
-
October 25th, 2010, 05:09 AM
#9
Re: CSplitterWnd. How to catch separator move action?
I do not understand what means 'directly handle WM_SIZE message'.
I thought it means do not use MESSAGE_MAP and OnSize and use Win32 ways. What means 'directly handle message'?
-
October 25th, 2010, 05:14 AM
#10
Re: CSplitterWnd. How to catch separator move action?
It means:
- GET RID OF PreTranslateMessage
- Implement message handler for WM_SIZE
Victor Nijegorodov
-
October 25th, 2010, 06:08 AM
#11
Re: CSplitterWnd. How to catch separator move action?
What did I do.
Code:
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
ON_WM_SIZE()
END_MESSAGE_MAP()
void CChildFrame::OnSize(UINT nType, int cx, int cy)
{
CMDIChildWnd::OnSize(nType, cx, cy);
//...
But OnSize called only when framewnd is changing size. It does not called when separators changed position.
-
October 25th, 2010, 06:13 AM
#12
Re: CSplitterWnd. How to catch separator move action?
Originally Posted by user008
What did I do.
Code:
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
ON_WM_SIZE()
END_MESSAGE_MAP()
void CChildFrame::OnSize(UINT nType, int cx, int cy)
{
CMDIChildWnd::OnSize(nType, cx, cy);
//...
But OnSize called only when framewnd is changing size. It does not called when separators changed position.
Yes! And AFAIR it is exactly what you wanted!
Originally Posted by user008
For recalculate what part of CSplitterWnd is each view and set views sizes when framewnd resized.
Victor Nijegorodov
-
October 25th, 2010, 06:30 AM
#13
Re: CSplitterWnd. How to catch separator move action?
Originally Posted by VictorN
Yes! And AFAIR it is exactly what you wanted!
I am sorry for my English. Probably I explained the problem poorly.
1. Separator changed postition - call function which calculate where is locate separators relativity them clients. For example 0.5 - in the middle.
2. When framewnd sizing separator get new positions by calculated values multiplied by new clients dimensions.
-
October 25th, 2010, 06:41 AM
#14
Re: CSplitterWnd. How to catch separator move action?
Originally Posted by user008
I am sorry for my English. Probably I explained the problem poorly.
1. Separator changed postition - call function which calculate where is locate separators relativity them clients. For example 0.5 - in the middle.
2. When framewnd sizing separator get new positions by calculated values multiplied by new clients dimensions.
Your English is pretty good (much better than mine)!
But your problem explanation is very poor.
As for 1. and 2.... I already wrote you what to do in the post#6:
Originally Posted by VictorN
...
Handle WM_SIZE, then use CSplitterWnd::SetColumnInfo/SetRowInfo followed by CSplitterWnd::RecalcLayout
Victor Nijegorodov
-
October 25th, 2010, 06:50 AM
#15
Re: CSplitterWnd. How to catch separator move action?
I know how to solve 2. And it works.
Do you mean to handle WM_SIZE in view? I understand it will work. But I am trying to catch event in framewnd, and do not call dynamic_cast<CChildFrame *>(GetParentFrame())->calculate() from all views. Do you mean this?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|