How to get object of a view which is created using AddView().
-
Hi In my mfc application i created a window with multiple tabs as follows:
class MainWind: public CTabView
{
void OnCreate(LPCREATESTRUCT lpstruct)
{
if (CTabView::OnCreate(lpCreateStruct) == -1)
return -1;AddView(RUNTIME\_CLASS(CView1), \_T("Sheet1")); }
}
class CView1 : public CScrollView
{
CView1()
{} void LoadData() { }
}
A window is created with one tab and CView1 is the view class for my window. After AddView() i want to call LoadData() function which is available in CView1 class. May i know how to get the object of CView1 class in my MainWindclass.
-
Hi In my mfc application i created a window with multiple tabs as follows:
class MainWind: public CTabView
{
void OnCreate(LPCREATESTRUCT lpstruct)
{
if (CTabView::OnCreate(lpCreateStruct) == -1)
return -1;AddView(RUNTIME\_CLASS(CView1), \_T("Sheet1")); }
}
class CView1 : public CScrollView
{
CView1()
{} void LoadData() { }
}
A window is created with one tab and CView1 is the view class for my window. After AddView() i want to call LoadData() function which is available in CView1 class. May i know how to get the object of CView1 class in my MainWindclass.
Can this discussion [[RESOLVED] MDI CTabView](http://forums.codeguru.com/showthread.php?540827-RESOLVED-MDI-CTabView) help you?
-
Hi In my mfc application i created a window with multiple tabs as follows:
class MainWind: public CTabView
{
void OnCreate(LPCREATESTRUCT lpstruct)
{
if (CTabView::OnCreate(lpCreateStruct) == -1)
return -1;AddView(RUNTIME\_CLASS(CView1), \_T("Sheet1")); }
}
class CView1 : public CScrollView
{
CView1()
{} void LoadData() { }
}
A window is created with one tab and CView1 is the view class for my window. After AddView() i want to call LoadData() function which is available in CView1 class. May i know how to get the object of CView1 class in my MainWindclass.
-
Can this discussion [[RESOLVED] MDI CTabView](http://forums.codeguru.com/showthread.php?540827-RESOLVED-MDI-CTabView) help you?
No. I am unable to get that View object. Any other way?
-
No. I am unable to get that View object. Any other way?
Then use the index returned by AddView. :suss:
-
You should capture the index value returned by CTabView::AddView[^]
I will get the index of view, but how to access that view using index.? I dint find any function like GetView(index) or something similar to it..
-
I will get the index of view, but how to access that view using index.? I dint find any function like GetView(index) or something similar to it..
Sampath579 wrote:
I will get the index of view, but how to access that view using index.? I dint find any function like GetView(index) or something similar to it..
You could try calling CTabView::SetActiveView followed by CTabView::GetActiveView
-
I will get the index of view, but how to access that view using index.? I dint find any function like GetView(index) or something similar to it..