?
Solved

How to disable dialogbar from floating?

Posted on 2003-03-19
9
Medium Priority
?
777 Views
Last Modified: 2013-11-20

I have a dialogbar that is allowed to be docked either to the top or bottom of the frame window. However, I would like to disable it from floating. How?
0
Comment
Question by:rrashedi
[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
  • 4
9 Comments
 
LVL 11

Expert Comment

by:KurtVon
ID: 8169194
First, override the OnMove command like so:

void CMyBar::OnMove(int x, int y)
{
    CDialogBar::OnMove(x, y);

    if (IsFloating())
        AfxGetMainWnd()->PostMessage(WM_USER, 0, (LPARAM)this);
}

then, in the main frame, catch the WM_USER message and call

LRESULT CMainFrame::OnUserMessage(WPARAM wParam, LPARAM lParam)
{
    DockControlBar((CMyBar*)lParam);
    return 0;
}

And the bar is still dragable between docking points, but auto-redocks to the last position if the user tries to float it.
0
 

Author Comment

by:rrashedi
ID: 8219947

Thanks for your comment.

Unfortunately, the CMyBar::OnMove() is never executed when the bar is dragged from its docked position. I think when the bar is floating the CMiniFrameWnd::OnMove is called instead.
0
 
LVL 11

Expert Comment

by:KurtVon
ID: 8220063
Hmm, the test program I threw off worked fine.  Are you sure you have an ON_WM_MOVE in the message map?  Or maybe the window is a child window of the actual docking window?
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 

Author Comment

by:rrashedi
ID: 8220160

Yes, the OnMove() implementation works. It is getting called properly when the bar is docked. But as soon as the bar becomes a floating bar, it is no longer accessed. I've verified this by placing a breakpoint and stepping through the code in debug mode.
0
 
LVL 11

Expert Comment

by:KurtVon
ID: 8220451
Odd.  Is your bar derived from CControlBar?  Also, CBRS_FLOAT_MULTI should not be set in the EnableDocking call (I'm fairly certain that is not the default, though).
0
 

Author Comment

by:rrashedi
ID: 8220592

It is derived from CDialogBar class. It is EnabledDocked
with CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM style as follows:
   CMyBar->EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM);
0
 
LVL 11

Expert Comment

by:KurtVon
ID: 8220942
Well, CDialogBar, when floated suddenly has the stye 0xcdcdcdcd which means the memory was not initialized.  This, of course, makes it CBRS_FLOAT_MULTI but I can't tell why.

I think I remember seeing something like this before, I just can't remember what does it, or why it is only at line 417 in DOCKCONT.CPP.

Let me think about it.  maybe I'll remember what caused that.
0
 
LVL 11

Accepted Solution

by:
KurtVon earned 200 total points
ID: 8226450
Okay, here's how to get around the CBRS_FLOAT_MULTI problem.  Just use the same code in the OnMove, but instead put it in the handler for WM_WINDOWPOSCHANGED.  I've tested and it works with a CDialogBar fine.

The message is the last one in the Class Wizard, and it definately gets called in all circumstances that I could think of.
0
 

Author Comment

by:rrashedi
ID: 8227309
It works great. Thanks for your assistance.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses

765 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