Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - How to make a CXTPToolBar non-movable?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to make a CXTPToolBar non-movable?

 Post Reply Post Reply
Author
Message
wssdev View Drop Down
Groupie
Groupie


Joined: 04 May 2010
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote wssdev Quote  Post ReplyReply Direct Link To This Post Topic: How to make a CXTPToolBar non-movable?
    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!
 
 
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post 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);
Back to Top
wssdev View Drop Down
Groupie
Groupie


Joined: 04 May 2010
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote wssdev Quote  Post ReplyReply Direct Link To This Post 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!

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.047 seconds.