Solved

How to Fix a size of CFormView in CSplitterWnd?

Posted on 2008-10-29
16
1,410 Views
Last Modified: 2013-11-20
Hi,
How to give Fixed Size for CFormViewin CSplitterWnd?..
0
Comment
Question by:srikadi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 7
  • 2
16 Comments
 
LVL 13

Expert Comment

by:kaylanreilor
ID: 22831617
Once you know the coordinates your windows is supposed to render into, you can store these values as members of your class to use them to display the window in the OnPaint() event handler. You can also, for example, set them into OnSize().
0
 

Author Comment

by:srikadi
ID: 22837754
I haven given size in OnSize() but it is taking parent window size and the splitter is also moving..i need fixed size spliiter
thanx..
0
 
LVL 13

Expert Comment

by:kaylanreilor
ID: 22838447
So it's always the same answer :  when you know the coordinates use them in OnPaint().
OnSize() will be use if you need to recalculate them only.

The problem also is that I'm not sure to understand "fized size" because generally it is the contrary : you have to code something if you need resizing a control with the parent.
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:srikadi
ID: 22840236
Hi,
i did like this..but its not working..
i wanto to give size of splitter is (0,30).i have given like this
    m_nwSplitter2.CreateView(4,0, RUNTIME_CLASS(CTaskFormView), CSize (0,30), pContext);
void CTaskFormView::OnSize(UINT nType, int cx, int cy)
{
 CFormView::OnSize(nType, 0, 30);
 // TODO: Add your message handler code here
 
}
is this correct?
0
 
LVL 13

Expert Comment

by:kaylanreilor
ID: 22848382
No, it's not correct. OnSize() is used to get the new coordinates from the parameters and then, for example, as I previously said, you can store them to use them later on.
As I said several time, if you want to DRAW your window, do it in OnPaint().
0
 

Author Comment

by:srikadi
ID: 22848794
Hi,
sorry,iam very begginer..i don't know what to write under CPaint..
0
 
LVL 13

Expert Comment

by:kaylanreilor
ID: 22848923
I didn't talk about CPaint but the even handler OnPaint() !
Into that method you can use SetWindowPos for example. There are many way to draw a window. I propose you google after having read that : http://msdn.microsoft.com/en-us/library/a1yzfz6d(VS.80).aspx
0
 
LVL 13

Expert Comment

by:kaylanreilor
ID: 22848931
0
 

Author Comment

by:srikadi
ID: 22850090
thanx..but its works for all spliiterbars..but i want to give fixed size for some panes not all..
0
 
LVL 13

Expert Comment

by:kaylanreilor
ID: 22850339
Hell, but did you really read my post #22848923 ?

I didn't talk about CPaint but the even handler OnPaint() !
Into that method you can use SetWindowPos for example. There are many way to draw a window. I propose you google after having read that : http://msdn.microsoft.com/en-us/library/a1yzfz6d(VS.80).aspx
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 22853643
srikadi,
Normally, one does not need to anything at all.  The View is drawn inside of its splitter pane.  It is resized automatically if the splitter is moved.  You can verify this by creating a new project (with no special code for OnSize).
If I am not understanding your question then please describe it in more detail.  If necessary, provide screen shots that show what it looks like now and what you want it to look like.
0
 

Author Comment

by:srikadi
ID: 22864506
Hi,
i have 6 splitterbars which are fixed size.but i want to make 3 splitterbars are fixed.i want CFormview are fixed but not CListViews in screenshot.

Doc1.doc
0
 
LVL 13

Accepted Solution

by:
kaylanreilor earned 500 total points
ID: 22864944
Did you at least try to use SetWindowPos with the coordinates you want in OnPaint() as I said it 5 days ago or not ?!? I think it's the 3rd time that I tell you that and you still don't answer !!!
Do you want me to stop talking to you ?

So I repeat again for the 4th time now :

Let's do something in the even handler OnPaint() which react to the message WM_PAINT !
Into that method you can use SetWindowPos FOR EXAMPLE to DRAW your window. There are many way to draw a window. I propose you google after having read that : http://msdn.microsoft.com/en-us/library/a1yzfz6d(VS.80).aspx
0
 

Author Comment

by:srikadi
ID: 22865024
Hi kaylanreilor:
yes,i had tried this one when u said.sorry,i forgot to tell u that its not working..still the form resizing..i did this one with ur other suggestion http://www.codeproject.com/KB/splitter/splitteroverride.aspx..
but still i have some problem with this..
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 22865289
Try
CSplitterWnd::SetRowInfo
http://msdn.microsoft.com/en-us/library/0hx5wwce(VS.80).aspx

That will let you set a minimum row height. If proper values are set, then that will freeze the sizes.
By the way, in your example, you are setting the height to 30 which is very short -- hardly room for a CFormView...
0
 

Author Comment

by:srikadi
ID: 22892466
Hi DanRollins:
i think CSplitterWnd::SetRowInfo is also peforms same function as CSIZE().
the height 30 which i have given is ok..its not short..showing perfectly..
 
0

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

707 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