Re: Hiding tab control for CTabView

"Political" <politicalconfusion-/[email protected]>
Newsgroups gmane.comp.windows.wtl
Message-ID <[email protected]>
In my case, I want to have a "hidden" configuration view.  I hook the keyboard and show the view on F2.  I don't need a tab control per se, but that seems like the easiest way to manage this.

In the past using MFC, I had an app with many views.  Depending on what was clicked in what view, a new view would fill the frame.  I used something similar to EkSwitchViewInFrame() from the MFC Answer Book.



--- In [email protected], "Nenad Stefanovic" <nenad2001@...> wrote:
>
> ShowTabControl() was not designed to be used that way. It is an
> implementation method to hide tab control when there are no views, and show
> it when there are some. Because of that UpdateLayout() doesn't take into
> account situation when a view is visible and tab control is not.
> 
> Fortunately, you can easily override UpdateLayout() to support this, as
> Alain showed below.
> 
> We might add that to the code since it doesn't change anything for the
> "normal" use. But, the real question is: why would you want to use tab view
> with hidden tab control? How is the user supposed to know that there are
> more views?
> 
> Cheers,
> Nenad
> 
> 
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Alain
> Rist
> Sent: Monday, May 10, 2010 11:13 PM
> To: [email protected]
> Subject: Re: [wtl] Hiding tab control for CTabView
> 
> Sorry for formatting and missing member :(
> 
> This does it, you may want to file a bug at
> http://sourceforge.net/tracker/?func=add&group_id=109071&atid=652372
> 
> class CMyTabView : public CTabViewImpl<CMyTabView>
> {
> public:
>     DECLARE_WND_CLASS_EX(_T("MyTabView"), 0, COLOR_APPWORKSPACE)
>     void UpdateLayout()
>     {
>         RECT rect;
>         GetClientRect(&rect);
>         const bool bTabVisible = m_tab.IsWindow() && ((m_tab.GetStyle() & 
> WS_VISIBLE) != 0);
>         if(bTabVisible)
>             m_tab.SetWindowPos(NULL, 0, 0, rect.right - rect.left, 
> m_cyTabHeight, SWP_NOZORDER);
>         if(m_nActivePage != -1)
>         {
>             const INT cyTabHeight = bTabVisible ? m_cyTabHeight : 0;
>             ::SetWindowPos(GetPageHWND(m_nActivePage), NULL, 0, cyTabHeight,
> 
> rect.right - rect.left, rect.bottom - rect.top - cyTabHeight, SWP_NOZORDER);
>         }
>     }
>     void ShowTabControl(bool bShow)
>     {
>         m_tab.ShowWindow(bShow ? SW_SHOWNOACTIVATE : SW_HIDE);
>        UpdateLayout();
>     }
> };
> 
> cheers,
> AR
> 
> 
> ----- Original Message ----- 
> From: Political
> To: [email protected]
> Sent: Tuesday, May 11, 2010 5:14 AM
> Subject: [wtl] Hiding tab control for CTabView
> 
> I've created an SDI application with CTabView as m_view. In 
> CMainFrame::OnCreate() I add my tab windows to the view and call 
> m_view.ShowTabControl( false ). The tab control does not show in the view, 
> but there is a dark gray bar across the top of the view where the tab 
> control would be shown.
> 
> Is it possible to have client area of CTabView fill the client area of 
> CMainFrame? I noticed there is a switch view in frame article at Code 
> Project, but one of the comments suggested using CTabView instead.
> 
> I'm using the latest WTL (revision 444) in VS2008 SP1 on Windows 7.
> 
> 
> 
> 
> ------------------------------------
> 
> Yahoo! Groups Links
>




------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.