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 Tech Support » How do I show a control bar docked inside another control bar? Collapse All
Subject Author Date
Chun Pong Lau Jul 17, 2008 - 5:53 AM

Dear support team,


When I dock 2 control bars inside a tabbed container by dragging to the center of docking marker,


How do I show up each one by program?


Thanks a lot.


Regards,


Chun Pong


 


 

Chun Pong Lau Jul 18, 2008 - 12:20 AM

According to a previous thread here (Controlling Docking Programatically ), I’ve written this function and it works now.

void CMainFrame::SelectDynTab(CExtControlBar* pBar2Select){
CWnd * pWndParent = pBar2Select>GetParent();
if (pWndParent->IsKindOf( RUNTIME_CLASS( CExtDockDynTabBar ) ) ){
// pBar2Select is inside a tabbed bar container
CExtDynTabControlBar * pTabbedBar = STATIC_DOWNCAST( CExtDynTabControlBar, pWndParent->GetParent() );
if (pTabbedBar){
LONG nCurrSel = pTabbedBar->GetSwitcherSelection();
LONG nBarIndex, nBarCount = pTabbedBar->GetSwitcherItemCount();
for( nBarIndex = 0; nBarIndex < nBarCount; nBarIndex ++ ){
CExtControlBar* pBar = pTabbedBar->GetBarAt( nBarIndex, false );
if (pBar == pBar2Select && nCurrSel != nBarIndex){
pTabbedBar->SetSwitcherSelection( nBarIndex, true, true );
break;
}
}
}
}
}

Technical Support Jul 17, 2008 - 1:00 PM

You should use CFrameWnd::ShowControlBar() method for each of your control bars. This method allows you to show several controlbars with delay. The CFrameWnd::RecalcLayout() method will apply delayed control bar layout and visibility changes.

Chun Pong Lau Jul 17, 2008 - 1:55 PM

No. It doesn’t work.

Let me describe more clearly. I don’t mean normal show/hide of a control bar. I am talking about selecting a control bar TABBED into a parent control bar.

The following image show the tabbed control bar I described:
http://www.prof-uis.com/img/tour_img/Visual_Studio_2008_Docking_Markers_Windows_XP_tab.png
the left highlight shadow is the tabbed control bar i am talking about. (by releasing upon the center of the docking marker)

What I wanted to do is to select the above tab by program. e.g. there are tab A, B, C, D, which are all tabbed together. Suppose tab A is in use. I would like to select another tab, say, B, by program.

Thanks a lot.

Technical Support Jul 17, 2008 - 2:25 PM

You need to know the following information which will allow you to dock resizable control bars into any layout:

1) Some of bars in your application should be docked initally to some sides of the main frame window using the CExtControlBar::DockControlBarInnerOuter() method. This method will dock resizable control bar into specified side of the main frame window and bar will allocate entire row or column closer to frame center or frame border (depending on parameters).

2) Some of bars will be initially switched into floating state using the CExtControlBar::FloatControlBar() method.

3) If you want to dock resizable control bar relatively to other already docked or floating bar, then you should invoke the CExtControlBar::DockControlBarLTRB() method (actually 2 overloaded methods with this name). This method does the same as left/right/top/bottom docking markers (which also known as guide diamonds).

4) If you want to dock resizable control bar into one tabbed group with other bar, then you should invoke the CExtControlBar::DockControlBarIntoTabbedContainer() method. The other bar can be either standing alone or already part of some tabbed group. This method does the same as central docking marker.

5) Invocation of the CExtControlBar::AutoHideModeSet() method will switch bar into auto-hidden mode. If bar is part of tabbed group, then all the bars in this tabbed group will become auto-hidden. Floating bars can not become auto-hidden.

6) Sending the WM_COMMAND message to main frame window and specifying dialog control identifier of resizable control bar window in the WPARAM parameter will activate/show bar and set focus to bar’s child window. This is true for resizable control bars in any state: docked, floating, auto hidden.

7) You can invoke CExtControlBar::SetInitDesiredSizeHorizontal() or CExtControlBar::SetInitDesiredSizeVertical() method for specifying desired height (at top/bottom side of main frame) or desired width (at left/right side of main frame) of resizable control bar before invoking its CExtControlBar::DockControlBarInnerOuter() method. You can invoke CExtControlBar::SetInitDesiredSizeFloating() and CExtControlBar::SetInitDesiredPosFloating() methods for specifying desired floating location of resizable control bar before invoking its CExtControlBar::SetInitDesiredPosFloating() method.

We guess item 4 is the most interesting for you, but we believe entire list will help in you in your project(s) development.

Chun Pong Lau Jul 17, 2008 - 10:47 PM

Dear support team,

I’m sorry to tell you that you MISUNDERSTOOD my question, which is NOT related to how to dock control bars. It’s about how to SELECT a tabbed control bar. Let’s me rephrase it.

Support there are two resizable control bars, BAR A & BAR B, they are both docked into another resizable control bars (a tabbed container), BAR C by DockControlBarIntoTabbedContainer().

Thus, all BAR A, B & C are tabbed together and suppose BAR A is activated and showing. BAR B & C are hidden.

If I want to select and activate BAR B by mouse, I can just simply click the tab below BAR B. Then BAR B will show up and BAR A & C will be hidden.

What I want to do now is to select the BAR B tab by program.

Do you understand my question? Thanks.

Chun Pong

Chun Pong Lau Jul 17, 2008 - 10:47 PM

Dear support team,

I’m sorry to tell you that you MISUNDERSTOOD my question, which is NOT related to how to dock control bars. It’s about how to SELECT a tabbed control bar. Let’s me rephrase it.

Support there are two resizable control bars, BAR A & BAR B, they are both docked into another resizable control bars (a tabbed container), BAR C by DockControlBarIntoTabbedContainer().

Thus, all BAR A, B & C are tabbed together and suppose BAR A is activated and showing. BAR B & C are hidden.

If I want to select and activate BAR B by mouse, I can just simply click the tab below BAR B. Then BAR B will show up and BAR A & C will be hidden.

What I want to do now is to select the BAR B tab by program.

Do you understand my question? Thanks.

Chun Pong

Chun Pong Lau Jul 17, 2008 - 10:59 PM

Dear support team, Below is the diagram representing the situation.


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

|                        |

|                        |

|                        |

|                        |

|         ______ |

|_A_|_B_|_C_|


Where BAR A is activated.


The question is now "How can I activate BAR B by program?


Regards,


Chun Pong

Technical Support Jul 18, 2008 - 7:06 AM

Our last answer in this thread already contains details about how to select and activate bar B: you should send the WM_COMMAND message to main frame window and specify dialog control identifier of bar B in WPARAM parameter:

CFameWnd * pMainFrame = . . .
CExtControlBar * pBarB = . . .
pMainFrame->SendMessage( WM_COMMAND, WPARAM( pBarB->GetDlgCtrlID() ) );

Chun Pong Lau Jul 19, 2008 - 11:03 AM

Sorry sirs, the above method isn’t working but this one. Please correct me if I am wrong.


void CMainFrame::SelectDynTab(CExtControlBar* pBar2Select){

    CWnd * pWndParent = pBar2Select->GetParent();

    if (pWndParent->IsKindOf( RUNTIME_CLASS( CExtDockDynTabBar ) ) ){

    // pBar2Select is inside a tabbed bar container

        CExtDynTabControlBar * pTabbedBar = STATIC_DOWNCAST( CExtDynTabControlBar, pWndParent->GetParent() );

        if (pTabbedBar){

            LONG nCurrSel = pTabbedBar->GetSwitcherSelection();

            LONG nBarIndex, nBarCount = pTabbedBar->GetSwitcherItemCount();

            for( nBarIndex = 0; nBarIndex < nBarCount; nBarIndex ++ ){

                CExtControlBar* pBar = pTabbedBar->GetBarAt( nBarIndex, false );

                if (pBar == pBar2Select && nCurrSel != nBarIndex){

                    pTabbedBar->SetSwitcherSelection( nBarIndex, true, true );

                    break;

                }

            }

        }

    }

}

Technical Support Jul 19, 2008 - 11:24 AM

The method is correct. But you can use the CExtControlBar::_GetNearestTabbedContainer() which returns pointer to tab container bar or NULL if the bar is not in the tabbed group:

CExtControlBar * pBar = . . .
CExtDynTabControlBar * pTabbedBar = pBar->_GetNearestTabbedContainer();
    if( pTabbedBar != NULL )
    {
        . . .
    }

You can also use the CExtDynTabControlBar::FindControlBar() method to get index of child bar inserted into group:
LONG nChildBarIndex = pTabbedBar->FindControlBar( pBar );
    if( nChildBarIndex >= 0 )
    {
        . . .
    }

Returned zero-based index value can be negative if specified bar is not found in the tabbed group.