Click to See Complete Forum and Search --> : Splitter window with different views on the same pane


Naron Souksaly
May 17th, 1999, 08:28 AM
Hi Everyone,

I have some problems with the CSplitterWnd class. I use that class to have 2 panes (or views).
On the left pane, I display a tree view and there is no problem. The problem is on the left pane I display
a right mouse popup menu. In this menu, I have different options, depending on the selection, we
display a different view on the right pane. It seems that it doesn't allow me to switch to different view.
It seems it allows only 1 view per pane. Can we associate different views on the same pane and SHOW or
HIDE them as needed? Maybe there is another way to do this...

Thanks,

Craig Muller
May 17th, 1999, 10:00 AM
Check an earlier posting on this very same problem from last friday/thursday. So far I can see no way around this problem but I believe if an intermediate window class was created to allow you to 'toggle' between 'n' child views it would be possible to place this class inside the splitter pane. There is and implementation of a 'Tabbed Window' which demonstrates this possibility <www.scasoftware.com>.
All one would have to do is remove the tabs and provide a member function to switch.

Craig.

James Dunning
May 17th, 1999, 11:16 AM
What I would do is for your splitter pane, create a container which will have an array of class views.

Your container class will need basically 3 functions

AddView(CRuntimeclass* pClassView);
SelectView(int iIndex);
ReplaceView(CRuntimeclass* pView);

addview will add a view to an array, you will need to keep a private member varable which will remember which view is currently active.

selectview will get the runtimeclass from your array, and call replaceview.

and replaceview will basically destroy your current view, and use the pointer pviewclass->CreateObject() to create a pointer to your newview, and slap it in your container, then finally call wm_initialupdate to update your view....

Hope you can understand this, cuz i cant *grin*

regards
james