Print Page | Close Window

Funny behaviour inside dialogs

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=1382
Printed Date: 06 March 2025 at 3:56am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Funny behaviour inside dialogs
Posted By: Uwe Keim
Subject: Funny behaviour inside dialogs
Date 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 - 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




Replies:
Posted By: Oleg
Date 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


Posted By: Uwe Keim
Date 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



Posted By: Oleg
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net