Print Page | Close Window

Dynamic toolbars question

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=3410
Printed Date: 02 July 2025 at 2:28pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Dynamic toolbars question
Posted By: yoavo
Subject: Dynamic toolbars question
Date 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.




Replies:
Posted By: Oleg
Date Posted: 15 December 2005 at 3:30am

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


Posted By: yoavo
Date Posted: 15 December 2005 at 5:46am

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 ?



Posted By: Oleg
Date Posted: 15 December 2005 at 8:11am

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



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