CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2003
    Location
    UK
    Posts
    21

    Creating child splitter window with in a parent splitter window

    Hi

    I have recently been experimenting with SDIs and splitter windows. I have come across a problem which I was hoping someone might help me solve.

    I have my SDI split as into a 2 column 2 row windoow. In the first column first row I have a form view which contains a button that resizes this pane . However it also resizes the first column second row at the same time. However This is not really what I intedned to happen. I simply wish the first column first row to resize leaving the second row intact.

    IS there some method I can use to get round this.? O

    One method I thought of was to move the view that is i nthe second row of the first column into the second row ofd the secoond coloumn and somehow split that second row into two child columns within that pane. However I have not had much luck. I tried a MDI ChldWin with splitter which generates an error when i try to build.

    Hope that makes sense.

    Thanks for any help

    El
    Regards

    Paul

  2. #2
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    Re: Creating child splitter window with in a parent splitter window

    You simply create nested splitters.
    Instead writing half a mile explanation, I have attched sample. See OnCreateClient in main frame class.
    Attached Files Attached Files
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

  3. #3
    Join Date
    Sep 2005
    Posts
    336

    Re: Creating child splitter window with in a parent splitter window

    Hi
    I searched some terms and saw this thread.

    In attached code:
    Code:
    m_wndInSplitterHigh.SetDlgCtrlID(m_wndSplitter.IdFromRowCol(0, 0));
    m_wndInSplitterLow.SetDlgCtrlID(m_wndSplitter.IdFromRowCol(1, 0));
    In msdn(for IdFromRowCol)
    Obtains the child window ID for the pane at the specified row and column.
    Who assigned the child window ID?
    I debugged it saw that:
    For 0, 0 ->> ‡ CSplitterWnd::IdFromRowCol returned 59648
    For 0,1 ->> ‡ CSplitterWnd::IdFromRowCol returned 59664

    I know that every child window must have a unique ID but it is assigned by programmer when creating window. But who assigned that numbers? If these are assigned by MFC automatically for splitter windows, is it only valid for Splitter window?

    Thanks for code.

  4. #4
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    Re: Creating child splitter window with in a parent splitter window

    Splitter. When you create non-nested splitter it is transparent. All panes are children of the splitter window, split bars are just drown and panes are part of the splitter, not a window embedded in a splitter. Splitter calculates pane’s ID based upon a position (row, col.).

    Splitter cannot be created using runtime information (as views are), hence you have to create nested splitter explicitly and assign ID that parent splitter will be able to parse as pane coordinates. ID is computed as follows: AFX_IDW_PANE_FIRST + row * 16 + col.; instead calculating it using this algorithm, splitter supplies function that does that: IdFromRowCol returns pane’s ID based on roe and col.

    How did you find post almost a year old?
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

  5. #5
    Join Date
    Sep 2005
    Posts
    336

    Re: Creating child splitter window with in a parent splitter window

    By searching.
    You attached many codes to your old posts. They are very helpful. Thanks.

    I want to ask one more question about Size parameter that we pass CreateView function. To be honest, i wrote many codes to understand splitter window or multi view apps but I still don't understand what CSize parameter actually do? (I mean how MFC use that parameter to show window)

    Sometimes it is (0, 0), sometimes (0, value) or (value, 0). Whatever value is assigned it shows something. How does MFC calculate dimensions?

    Thanks for help.

  6. #6
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    Re: Creating child splitter window with in a parent splitter window

    Size of all the panes of the splitter is determined by the size of the first pane.
    Splitter panes are organized in the same order like left-to-right reading.

    Once first splitter’s size is calculated, next panes are resized to whatever is leftover in the client area of the splitter.

    For example: in 4-pane splitter 500x400 (width, height); set size of the first pane to 100x200.
    You can set Size(0, 0) for the next pane. It will have size 400x200.
    Third pane size can be set to Size(400, 0) for example. Height is already determined (300). Therefore, pane 3 will have size 400x300 and the last will have 100x200.
    Size you set is called ideal size, meaning that ideally splitter pane will have requested size. It is not always possible, that is why I have omitted irrelevant values.

    Now off the topic, just to let you know about intricacies of English. Please do fill offended, I am just trying to help.
    There is slight difference between "writing codes" and "writing code". Writing codes, means writing system of letters or numbers, like coding a message in a spy business. Writing code means writing rules and regulations and that includes programming. Since we are not in a spy business, we are writing code. I just thought you ought to know.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

  7. #7
    Join Date
    Sep 2005
    Posts
    336

    Re: Creating child splitter window with in a parent splitter window

    OK. Thank you very much...

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