Solved

How to Fix a size of CFormView in CSplitterWnd?

Posted on 2008-10-29
16
1,340 Views
Last Modified: 2013-11-20
Hi,
How to give Fixed Size for CFormViewin CSplitterWnd?..
0
Comment
Question by:srikadi
  • 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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
viewing source code from eclipse 13 74
Hibernate methods 2 58
lucky13 challenge 11 112
mapShare challenge 13 68
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
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…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

757 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

17 Experts available now in Live!

Get 1:1 Help Now