How to make a CXTPToolBar non-movable?
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=16848
Printed Date: 20 June 2025 at 11:49am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: How to make a CXTPToolBar non-movable?
Posted By: wssdev
Subject: How to make a CXTPToolBar non-movable?
Date Posted: 18 June 2010 at 11:30am
Is there a way to make a CXTPToolBar non-movable/non-draggable/non-floating? I want to put it in the top-left corner of the main frame window and to make it stay there (by not having a gripper and not reacting to moust draggining).
Here's how I create it:
int MyFrameWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CXTPFrameWnd::OnCreate(lpCreateStruct) == -1) return -1;
CXTPCommandBars* pCommandBars = GetCommandBars(); CXTPToolBar* myToolbar = static_cast<CXTPToolBar*>(pCommandBars->Add(_T("MyToolbar"), xtpBarTop)); // How to make it non-movable, non-draggable, non-floating..? myToolbar->?
Thanks in advance!
|
Replies:
Posted By: SuperMario
Date Posted: 21 June 2010 at 9:01am
pCommandBar->SetFlags(0, xtpFlagFloating|xtpFlagAlignTop|xtpFlagAlignLeft|xtpFlagAlignRight|xtpFlagAlignBottom); pCommandBar->SetShowGripper(FALSE); (where pCommandBar is a CXTPCommandBar*)
The SetFlags call disables floating and limits docking to the top section. Specifying removal of xtpFlagAlignTop prevents the user from dragging the menu bar up and down within the top docking area. The SetShowGripper call removes the gripper, visually indicating to the user that the bar is fixed. Also, it seems that the absence of the gripper gives the menu bar its own row.
Also can use:
pCommandBar->EnableDocking(0);
|
Posted By: wssdev
Date Posted: 21 June 2010 at 9:24am
EnableDocking(0) is what I tried after writing this message, and it did do the trick.
However, I prefer your approach using setFlags(). It feels somewhat safer because it removes only relevant flags.
Also, I'm using an older XTP version (10.30) that does not have SetShowGripper() so I ended up calling
pToolBar->ModifyBarStyle(CBRS_GRIPPER, 0);
Thanks for your help!
|
|