Print Page | Close Window

MDI Tabs - Ensure Visible

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=286
Printed Date: 16 May 2024 at 5:00pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: MDI Tabs - Ensure Visible
Posted By: Boyd
Subject: MDI Tabs - Ensure Visible
Date 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.




Replies:
Posted By: tomhermolle
Date 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.


Posted By: Oleg
Date 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


Posted By: vladsch
Date 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.

 



Posted By: Boyd
Date 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!




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net