Let's say I have a class CMyView derived from CView whose constructor can take parameters which influence the view's initial appearance (e.g. an RGB value to set the background color).
Now I want to use CSplitterWnd and create TWO views with CMyView as the runtime class. The two views are supposed to be initialized with different parameters though and therefore have a different initial appearance.
Since I can only pass the runtime class to CSplitterWnd::CreateView how is it possible to influence the construction of the view used with CSplitterWnd?
Let's say I have a class CMyView derived from CView whose constructor can take parameters which influence the view's initial appearance (e.g. an RGB value to set the background color).
Now I want to use CSplitterWnd and create TWO views with CMyView as the runtime class. The two views are supposed to be initialized with different parameters though and therefore have a different initial appearance.
Since I can only pass the runtime class to CSplitterWnd::CreateView how is it possible to influence the construction of the view used with CSplitterWnd?
Thanks in advance!
You will have a view for the program that will own the splitter:
CSplitterWnd m_wndSplitter;
In the OnCreate for your program's main view, you will initialize the splitter and set up two panes:
m_wndSplitter.CreateStatic(this,1, 2); //Creates two side by side panes
Then you create each pane and do an instance of CMyView in each:
I now see that my question doesn't make much sense in the way that i want to pass parameters to the constructor of the view, since the constructor is of course protected...
Thank you for your answer, wdolson! This is exactly what i needed to know.
Bookmarks