Solved

MFC splitter Windows

Posted on 1998-11-28
3
963 Views
Last Modified: 2013-11-20
Hi,
When a splitter window is created, MFC seems to only like it when you specify a view for EVERY column and row, else you get an assertion.  I want to be able to have a single static splitter window with 2 columns in the top row and one column in the bottom row (this is for an IRC client), but at the moment i can only have it so that there are 2 columns in both the top and bottom rows.
Anyone know How I get around this? (100)
Thanks a lot...
Chris
0
Comment
Question by:cpj196
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
motigust earned 150 total points
ID: 1325413
You need to splitters here:

1. The first splitter splits the window Horizontaly (one at the
top and one at the bottom)

2. The second splitter splits the upper window vertically.

In order to do that:
1. Create a regular horizontal splitter (Using the wizard)
2. Using the upper view of that splitter create another one
(Vertical)

good luck.


0
 

Author Comment

by:cpj196
ID: 1325414
Thanks!,
This was very helpful, and i now have 3 panes as required.  Although, i am still having probelms with the initial sizing when the window is created.  I have a size structure that contains the window size by getting the client rect area.  Ideally, when the application loads, i want the bottom pane  (for typing into) to be about 30 pixels high, the top left pane (for receiving IRC messages) to be y - 30 pixels high and x - 100 pixels wide, and the top right pane (for displaying usernames of users on current channel) to be y-30 pixels high and 100 pixels wide.
The code i am using is not working, creating all the panes but then making the bottom one (typing into pane) take up the entire window!
I am using the following code...

BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT,
      CCreateContext* pContext)
{
      if (m_wndSplitter.CreateStatic(this,2,1)) // OK
      {
            CRect rect;
            GetClientRect(&rect);
            CSize size = rect.Size();
            
            if (m_topwndSplitter.CreateStatic(&m_wndSplitter,1,2, WS_CHILD | WS_VISIBLE | WS_BORDER, m_wndSplitter.IdFromRowCol(0, 0)))
            {
                  if (m_topwndSplitter.CreateView(0,0,RUNTIME_CLASS(CChatView),CSize(size.cx-120,size.cy-30),pContext))
                  {                        
                        if (m_topwndSplitter.CreateView(0,1,RUNTIME_CLASS(CNameView),CSize(0,0), pContext))
                        {
                              if (m_wndSplitter.CreateView(1,0,RUNTIME_CLASS(CSendView),CSize(0,0),pContext))
                              {
                                    SetActiveView((CView*)m_wndSplitter.GetPane(1,0));
                                    return TRUE;      
                              }
                                                                        
                        }
                  }
            }
      }
      return FALSE;
}


Wot am i doing wrong! ?
Please help! :-)
Thanks again for the previous response,
Chris J
0
 
LVL 1

Expert Comment

by:motigust
ID: 1325415
cpj,

To move the horizontal splitter up and down use

int posy = 30; // x position
m_wndSplitter.SetRowInfo(0,posy,posy);

To move the vertical splitter left and right use

int posx = 180; // y position
m_topwndSplitter.SetColumnInfo(0,posx,posx);

Use these funtions after the splitter were created


0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Running shell command from Access 3 63
wordmultiple challenge 12 89
Path of Workbook 3 45
Problem to event 3 49
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now