Solved

Prevent Floating in CControlBar

Posted on 2002-06-17
5
687 Views
Last Modified: 2013-11-20
Hi,

I am using a CControlBar to implement a VS6 like dockable/floating tool palette. On the other hand, I would like to disalbe the floating part so that it only docks.

Does anybody have an answer?

Cheers
Yida
0
Comment
Question by:ymao
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 7086351
Call CControlBar's EnableDocking function.

GOOD LUCK
0
 

Author Comment

by:ymao
ID: 7090108
Hi Roshan,

Thanks for getting back to me. Can you be more specific about when to call EnableDocking and with what params? It seems to me that EnableDocking only enables the CControlBar to be docked at a specific side of the frame window.

The user experience is that: I would like user to be able to dock the control bar to any side of the window. But I don't allow them to make the control bar float.

Thanks
Yida
0
 
LVL 16

Accepted Solution

by:
AlexNek earned 200 total points
ID: 7090174
2 ymao
When you create you toolbar pay attention to Create and SetBarStyle functions.

CToolBar::Create
parameter dwStyle must not have the flag CBRS_FLOATING.

BarStyle must not have the style CBRS_FLOAT_MULTI but CBRS_ALIGN_ANY.

dwOldStyle = ... GetBarStyle() & (~CBRS_FLOAT_MULTI);
...SetBarStyle( dwOldStyle | CBRS_ALIGN_ANY);

To dock toolbars to a frame window, the frame window (or destination) must be enabled to allow docking. This is done using the CFrameWnd::EnableDocking(CBRS_ALIGN_ANY)

After you have prepared the destination for docking, you must prepare the toolbar (or source) in a similar fashion. Call CControlBar::EnableDocking(CBRS_ALIGN_ANY) for each toolbar you want to dock.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question