Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Dynamic toolbars question
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Dynamic toolbars question

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


Joined: 29 February 2004
Location: Israel
Status: Offline
Points: 140
Post Options Post Options   Thanks (0) Thanks(0)   Quote yoavo Quote  Post ReplyReply Direct Link To This Post Topic: Dynamic toolbars question
    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.

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: 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
Back to Top
yoavo View Drop Down
Senior Member
Senior Member


Joined: 29 February 2004
Location: Israel
Status: Offline
Points: 140
Post Options Post Options   Thanks (0) Thanks(0)   Quote yoavo Quote  Post ReplyReply Direct Link To This Post 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 ?

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: 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
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.109 seconds.