Click here to Skip to main content
16,008,010 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a CFrameWnd with a three way static split; two columns with the right column being split horizontally. The left column is a CListView derivative. The top-right and bottom-right views are CFormView derivatives. I can calculate the size of each pane and I use that information in calls to SetColumnInfo()/SetRowInfo(). Given the sizes of each pane, how can one resize the CFrameWnd to the desired size of the CSplitterWnds taking into account menu, title bar, menu bar and tool bar?

Regards

What I have tried:

I have tried so many things it is hard to remember them all now. I have read/tried every article/question I have found on here, Codeguru and StackOverflow. I have tried changing pane sizes and window sizes in CFrameWnd::PreCreateWindow(), CFrameWnd::OnCreateClient(), CFrameWnd::OnSize(). Nothing I find really addresses that I want the primary splitter window to have a fixed size that I calculate and how to adjust the frame window to have that client size.
Posted
Updated 23-Jun-16 10:54am
Comments
Sergey Alexandrovich Kryukov 23-Jun-16 15:00pm    
I would not do it. You cannot get reliable results from such calculations. Why not allowing the user to change the size and splitter positions? After all, this is the whole purpose of this layout technique.
—SA
Craig Hewitt 23-Jun-16 16:11pm    
If the forms are fixed in size, it makes no sense to support resizable splitter windows unless one also want to go through the hassle of a layout manger to manage all of the control postions. The UI would no longer be aesthetically pleasing to the eye.

Why can you not get reliable results from the different calculations? Borders, splitter bars, etc all have sizes that can be calculated at runtime.

Craig
Sergey Alexandrovich Kryukov 23-Jun-16 16:48pm    
That's the whole idea: perhaps it means that fixed-size form makes no sense. Here is the idea for you: instead of dealing with ill-posed problems, it's better to do better UI design.

Calculation of metric during runtime is possible: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724385%28v=vs.85%29.aspx.

But it does not mean that you can pick all the information. A form class can have it's own layout elements which are not exposed to any API. Calculate at runtime? Sure, but where you get input data?

—SA

1 solution

Please see my both comments to the question.

Here is my advice: don't do it. Instead, create a nice UI design. Generally, I have no idea who ever needs those fixed-size windows, especially with splitters inside. If something is resizable inside a form, a form should be resizable, otherwise the form may just drive the users crazy.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900