Dynamic toolbars question |
Post Reply |
Author | |
yoavo
Senior Member Joined: 29 February 2004 Location: Israel Status: Offline Points: 140 |
Post Options
Thanks(0)
Posted: 15 December 2005 at 12:46am |
Hi, In my application I need to implement the following behaviour: I have a Main toolbar which is docked to the right, and it has a two-part button (a control with the style xtpControlSplitButtonPopup). I want the following behaviour: 1. pressing the right side of the "Two-Part" control will open a menu with 3 commands. 2. pressing the left side of the control will open a floating toolbar(with the same 3 commands), which will be placed near the button, and will be open vertically. The first part was easy, but I have difficulties in creating the floating toolbar (I am trying to create it in OnCommand method of the Main window): - How to create the toolbar ? (I tried the following code in CMainFrame::OnCommand, but I do not see any toolbar): Note: I am trying to create the toolbar using ::CreatePopupToolbar and not by calling "GetCommandBars()->Add(...)", because I do not want the toolbar to be saved in the layout of the commandbars so if the program is closed and open again, the toolbar will not be shown on start. BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam) { int aId = wParam;if (aId = 555) { CXTPPopupToolBar* pPopupToolBar = CXTPPopupToolBar::CreatePopupToolBar(GetCommandBars()); pPopupToolBar->EnableCustomization(FALSE); CXTPControl* pControl1 = pPopupToolBar->GetControls()->Add(xtpControlButton, ID_FILE_NEW); CXTPControl* pControl2 = pPopupToolBar->GetControls()->Add(xtpControlButton, ID_FILE_OPEN); CXTPControl* pControl3 = pPopupToolBar->GetControls()->Add(xtpControlButton, ID_FILE_SAVE); } return CMDIFrameWnd::OnCommand(wParam, lParam); } - How can I create the toolbar so it will be vertical and not horizontal ? Yoav. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
It is nott very friendly for user... My suggestion to use tear-off popup if user click right part of button (see TearOffPopups sample) so user can manually drag it and make toolbar. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
yoavo
Senior Member Joined: 29 February 2004 Location: Israel Status: Offline Points: 140 |
Post Options
Thanks(0)
|
I looked a the TearOffPopups sample. it look nice. NeverTheLess, the our engeeners wants the behaviour I mentioned before... Is it possible to create a float toolbar when preesing a button ? |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
yes, why not. but instead CXTPPopupToolBar::CreatePopupToolBar use pCommandBars->Add(..) and check if it was not added before pCommandBars->GetToolBar(nBarId); To float call pToolBar->SetPosition(xtpBarFloating); + SetWindowPos
May be better create this toolbar in CMainFrame::OnCreate and hide it (SetVisible(FALSE) and show after user click button.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |