Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » SDI Tabbed View Collapse All
Subject Author Date
Kotaro Takahashi Jul 11, 2005 - 11:17 AM

Hi,


I’d like to know how to create a very simple Tabbed View SDI application.


I see some SDI sample applications like this with docking windows features; however,


I just need a simple static tabbed view for switching 2 views.


 


Thanks,

Kotaro

Technical Support Jul 11, 2005 - 12:55 PM

You can create an instance of the CExtTabPageContainerWnd window as a child of CMainFrame. CExtTabPageContainerWnd is a tab page container and it is exactly what you need.
Add CExtTabPageContainerWnd variable to the CMainFrame header, then create the tab window in the CMainFrame::OnCreate() method:

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if( CFrameWnd::OnCreate(lpCreateStruct) == -1 )
        return -1;
    if( ! m_wndTabPageContainer.Create(
            this,
            CRect( 0, 0, 0, 0 ),
            AFX_IDW_PANE_FIRST
            )
        )
    {
        TRACE0("Failed to create view window\n");
        return -1;
    }
    
    ...
    ...
    ...
}
To insert tab pages, use the CExtTabPageContainerWnd::PageInsert() method.

Kotaro Takahashi Jul 12, 2005 - 9:22 AM

Thank you for your information.
Is there source code for an example application I can look at?

Technical Support Jul 12, 2005 - 12:14 PM

SimpleGrids is an SDI sample in which CExtTabPageContainer is used as a child window.



Kotaro Takahashi Jul 13, 2005 - 2:56 PM

I added lines to MainFrm.cpp

    if( ! m_wndTabPageContainer.Create(
this,
CRect( 0, 0, 0, 0 ),
AFX_IDW_PANE_FIRST
)
)
{
TRACE0("Failed to create view window\n");
return -1;
}

Now, when I call PageInsert method?
Sorry, I don’t get it yet...

Thanks,
Kotaro


Kotaro Takahashi Jul 13, 2005 - 11:51 PM

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>


I have solved my own problem.
I have created a class inherit from CExtTabPageContainer, like your SimpleGrid example.
Then, called PageInsert in the class.
It looks like working. Is that right?


Thank you for your help.


Thanks,
Kotaro

<o:p></o:p>


 

Technical Support Jul 14, 2005 - 7:10 AM

You can call the PageInsert method just after you create the CExtTabPageContainer window.

Below is the code which creates a tab page container and inserts a page with a dialog inside.


if( ! m_wndTabPageContainer.Create(  

        this,            

        CRect( 0, 0, 0, 0 ),           

        AFX_IDW_PANE_FIRST            

        )        

    )    

{        

    TRACE0("Failed to create view window\n");        

    return -1;    

}

 

if( !m_wndTabPageDialog0.Create(

    IDD_DIALOG_FOR_TAB_PAGE,

    &m_wndTabPageContainer

    )

    )

{

    TRACE0("Failed to create m_wndTabPageDialog0\n");

    return -1;        // fail to create

}

m_wndTabPageDialog0.ShowSizeGrip( FALSE );

 

VERIFY( m_wndTabPageContainer.PageInsert( &m_wndTabPageDialog0, _T("Dialog") ) );



Kotaro Takahashi Jul 15, 2005 - 8:50 AM

Thank you for your information.


Now, I have 2 Views that Inserted to m_wndTabPageContainer. How can I make 2 views attach to one Document?


Thanks,


Kotaro

Technical Support Jul 15, 2005 - 12:24 PM

We assume you have a CDocument pointer to some document object. You can pass it into your CView-derived class which should save it in the CView::m_pDocument property and invoke the m_pDocument->AddView( this ) code. After this your view and document should become linked to each other.

Kotaro Takahashi Jul 16, 2005 - 10:13 AM

Thank you! Now I see. Just one more small question.
I have a view window in front of the Tab view, and I thiks the reason is the line shown below:
in my Editor.cpp:

    CSingleDocTemplate* pDocTemplate;
    pDocTemplate = new CSingleDocTemplate(
        IDR_MAINFRAME,
        RUNTIME_CLASS(CEditorDoc),
        RUNTIME_CLASS(CMainFrame), // main SDI frame window
        RUNTIME_CLASS(CEditorView)); <- here
    AddDocTemplate(pDocTemplate);

CEditorView is CView-derived class, and I don’t use it.
How do I make this CEditorView disable,
and make it use views PageInsert-ed to CExtTabPageContainerWnd?

Technical Support Jul 17, 2005 - 8:56 AM

You don’t have to disable the CEditorView class. This view window will become a container for your tab page container within other views.

Kotaro Takahashi Jul 19, 2005 - 9:16 PM

> This view window will become a container for your tab page container within other views.

Sorry, I tried but I don’t get it. I still see a view window on top of everything. Would you please show me more details if possible.


Thanks,


Kotaro

Technical Support Jul 20, 2005 - 6:24 AM

You gave us a general outline of what you need to do. That is why we described a general approach to how ti can be done. To provide you with help at this point, we need to take a look at your source code and find out what’s wrong. Could you send us your project?

Kotaro Takahashi Jul 20, 2005 - 9:54 AM

Thanks, that is great!
Kotaro

Kotaro Takahashi Jul 20, 2005 - 10:30 AM

Please let me know your technical support email address so that I can send you my project.
Thanks,
Kotaro

Technical Support Jul 20, 2005 - 10:39 AM

You can send your project to support@prof-uis.com.