Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Funny behaviour inside dialogs
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Funny behaviour inside dialogs

 Post Reply Post Reply
Author
Message
Uwe Keim View Drop Down
Newbie
Newbie


Joined: 01 November 2004
Location: Germany
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote Uwe Keim Quote  Post ReplyReply Direct Link To This Post Topic: Funny behaviour inside dialogs
    Posted: 08 November 2004 at 1:03am

I have a dialog box (derived from CXTPDialogBase) that is resizable (I don't use the XT sizable dialogs but this class: http://www.codetools.com/dialog/dynwindow.asp, because I just switched to XT and used the other class already since 2 years).

Now I added a menu bar (CXTPMenuBar), a tool bar (CXTPToolBar) and a status bar (CXTPStatusBar) to the dialog. The dialog then looks like this:

Now I have a strange behaviour, in that every time the user clicks a tool bar button or a menu bar button and then the dialog is resized by the user, the last-clicked bar (menu bar or tool bar) is put on top of the other. Let me explain:

1.) The user clicks a tool bar button:

2.) Then the user resizes the dialog. Now the tool bar moves up:

3.) The user now clicks a menu bar item:

4.) And then resizes the dialog again. Now the menu bar jumps up again to the correct position:

Question: Can you please tell me how I can tell that bars to keep their positions?

More informationen: Whenever a WM_SIZE event occurs, I do the following code on the bars to keep them fill up the whole dialog width:

RepositionBars(
    AFX_IDW_CONTROLBAR_FIRST,
    AFX_IDW_CONTROLBAR_LAST,
    0 );

ToolBar.InvalidateParents();

Thank you for enlightening me .
Uwe

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: 08 November 2004 at 12:16pm

in void CXTPToolBar::OnLButtonDown(UINT nFlags, CPoint point) of source code

replace

SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);

to

 if (m_barPosition == xtpBarFloating)
  SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);

 

in next version we will fix it too.

 

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Uwe Keim View Drop Down
Newbie
Newbie


Joined: 01 November 2004
Location: Germany
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote Uwe Keim Quote  Post ReplyReply Direct Link To This Post Posted: 08 November 2004 at 11:17pm

Thanks Oleg! My product ships in February 2005. So I will wait and if there is no next version I will recompile the sources as you mentioned.

Thanks
Uwe

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: 09 November 2004 at 2:16am

If you don't want to change source code, you can override CXTPToolBar and its OnLButtonDown method:

void CToolBar::OnLButtonDown(UINT nFlags, CPoint point)
{

    if (m_barPosition != xtpBarFloating)

      return CXTPCommandBar::OnLButtonDown(nFlags, point);

  return CXTPToolBar::OnLButtonDown(nFlags, point);

}

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