Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - MDI Tabs - Ensure Visible
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

MDI Tabs - Ensure Visible

 Post Reply Post Reply
Author
Message
Boyd View Drop Down
Senior Member
Senior Member


Joined: 08 December 2003
Location: United States
Status: Offline
Points: 285
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boyd Quote  Post ReplyReply Direct Link To This Post Topic: MDI Tabs - Ensure Visible
    Posted: 09 December 2003 at 9:09am

When using the MDI Tabs with the CommandBars, is there a way to ensure that a particular tab is visible?

For example, imagine you have 30 windows open and only 5 can be displayed.  If the user switches to that window using the Window List in the menu, I would like to ensure that the MDI Tab for that window is visible in the tab strip.

Also, there is a cosmetic bug when you close child windows.  If you have a lot of windows opened, you can scroll the MDI Tabs to the right to see more tabs.  If you scroll all the way to the right and then start closing child windows, the scrolled position of the MDI Tabstrip doesn't change and eventually there are no viewable MDI tabs until you scroll back to the left.  As child windows are closed, the scrolling tabstrip should adjust to be no further than the right-most visible MDI Tab.

Finally, the 'ShowTabWorkspace' method returns a reference to a 'TabWorkspace' object.  This object has only one memeber, 'Flags'.  The ActiveX documentation does not document what the available flags are.  Could you please share this information?

Thank you for your feedback.

Back to Top
tomhermolle View Drop Down
Newbie
Newbie
Avatar

Joined: 22 October 2003
Location: United Kingdom
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote tomhermolle Quote  Post ReplyReply Direct Link To This Post Posted: 18 December 2003 at 11:54am
Hear hear! More information on the TabWorkspace object would be much appreciated, as would a way of being able to either switch off, or dynamically set, the colour of the tabs.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 16 January 2004 at 11:53am

 

Please wait 8.62 release. It will be a lot of enhancements of TabWorkspace.

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
vladsch View Drop Down
Newbie
Newbie


Joined: 04 February 2004
Location: Canada
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote vladsch Quote  Post ReplyReply Direct Link To This Post Posted: 05 February 2004 at 8:30pm

Hi Boyd:

I don't know if you are still looking for this functionality but I just implemented it in a copy of CXTPTabWorkspace for myself. Mind you my version of Tabworkspace is changed a lot because I need a lot of non-standard functionality. I only included the items needed to make the tabs visible. Here is the long version:

Add a member function to CXTPTabWorkspace:

void CXTPTabWorkspace::MakeTabVisible(int nTab)
{

    CRect rc;
    CRect rcTab = m_arrTab[nTab].rcItem;

    GetClientRect(&rc);
   // Uncomment if you apply the button area exclusion region from the hit test
   // I made in another post in Xtreme Toolkit (Professional and Standard Editions)
   // without this the last visible tab will be clipped by the button (left/right/close) area
   // rc.right -= m_nButtonWidth;

    if (!rc.PtInRect(CPoint(rcTab.left, rcTab.top))
        || !rc.PtInRect(CPoint(rcTab.right, rcTab.top)))
    {
        if (rcTab.left < rc.left)
        {
             m_nOffset += rc.left - rcTab.left+6;
        }
        else
        {
             m_nOffset -= rcTab.right - rc.right;
        }

        if (m_nOffset > 6) m_nOffset = 6;
        InvalidateRect(NULL);
    }
}

In void CXTPTabWorkspace::OnLButtonDown(UINT nFlags, CPoint point) right after sending WM_CLOSE to the MDI Child add the code after comment // insert the code below:


     pActiveChildWnd->SendMessage(WM_CLOSE);

     // insert the code below
     UpdateContents(FALSE);
     pActiveChildWnd= MDIGetActive();
     int nFoundItem=FindTabItem(pActiveChildWnd->GetSafeHwnd());
 
     if (nFoundItem >= 0)
     {
         MakeTabVisible(nFoundItem);
     }


Also insert the call to MakeTabVisible in the following, I am including surrounding lines to make it ieasier to see the context. Just the call to MakeTabVisible needs to be inserted

void CXTPTabWorkspace::OnLButtonUp(UINT nFlags, CPoint point)
{
    if (m_nItemTracking != -1)
    {
        MakeTabVisible(m_nItemTracking);

Partially visible tab is scrolled into view when you release the left mouse button after a click. Also partially visible (or invisible) tabs will scroll into view after close button is pressed.

 

Back to Top
Boyd View Drop Down
Senior Member
Senior Member


Joined: 08 December 2003
Location: United States
Status: Offline
Points: 285
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boyd Quote  Post ReplyReply Direct Link To This Post Posted: 06 February 2004 at 7:56am

Hi vladsch,

Thank you for the detailed information about your implementation.  Unfortunately, I'm using the ActiveX version and don't have access to the source code.  Looks like I'll have to wait for 8.62 release.  Thanks anyway!

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.