CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Join Date
    Oct 2010
    Location
    Russia
    Posts
    69

    CSplitterWnd. How to catch separator move action?

    How to catch separator move action?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: CSplitterWnd. How to catch separator move action?

    What for?
    Victor Nijegorodov

  3. #3
    Join Date
    Oct 2010
    Location
    Russia
    Posts
    69

    Re: CSplitterWnd. How to catch separator move action?

    For recalculate what part of CSplitterWnd is each view and set views sizes when framewnd resized.

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: CSplitterWnd. How to catch separator move action?

    Victor Nijegorodov

  5. #5
    Join Date
    Oct 2010
    Location
    Russia
    Posts
    69

    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.

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: CSplitterWnd. How to catch separator move action?

    Quote Originally Posted by user008 View Post
    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

  7. #7
    Join Date
    Oct 2010
    Location
    Russia
    Posts
    69

    Re: CSplitterWnd. How to catch separator move action?

    Quote Originally Posted by VictorN View Post
    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?

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    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

  9. #9
    Join Date
    Oct 2010
    Location
    Russia
    Posts
    69

    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'?

  10. #10
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: CSplitterWnd. How to catch separator move action?

    It means:
    1. GET RID OF PreTranslateMessage
    2. Implement message handler for WM_SIZE
    Victor Nijegorodov

  11. #11
    Join Date
    Oct 2010
    Location
    Russia
    Posts
    69

    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.

  12. #12
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: CSplitterWnd. How to catch separator move action?

    Quote Originally Posted by user008 View Post
    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!

    Quote Originally Posted by user008 View Post
    For recalculate what part of CSplitterWnd is each view and set views sizes when framewnd resized.
    Victor Nijegorodov

  13. #13
    Join Date
    Oct 2010
    Location
    Russia
    Posts
    69

    Re: CSplitterWnd. How to catch separator move action?

    Quote Originally Posted by VictorN View Post
    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.

  14. #14
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: CSplitterWnd. How to catch separator move action?

    Quote Originally Posted by user008 View Post
    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:
    Quote Originally Posted by VictorN View Post
    ...
    Handle WM_SIZE, then use CSplitterWnd::SetColumnInfo/SetRowInfo followed by CSplitterWnd::RecalcLayout
    Victor Nijegorodov

  15. #15
    Join Date
    Oct 2010
    Location
    Russia
    Posts
    69

    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?

Page 1 of 2 12 LastLast

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
  •  





Click Here to Expand Forum to Full Width

Featured