![]() |
detect docking / floating state in OnSize? |
Post Reply
|
| Author | ||||
Michl
Senior Member
Joined: 14 September 2007 Status: Offline Points: 138 |
Post Options
Thanks(0)
Quote Reply
Topic: detect docking / floating state in OnSize?Posted: 22 September 2009 at 12:27pm |
|||
|
Hello,
we using Codejock v11.22. Perhaps it was already changed... or is this code okay? How can I detect that my docked toolbar is now in floating state in OnSize?? If a user move a dockingable toolbar, following code will be called:
[code} BOOL CXTPCommandBars::FloatCommandBar(CXTPToolBar* pBar) { if (!pBar->Create(m_pFrame, TRUE)) { return FALSE; } if (pBar->m_pDockBar != NULL) { pBar->m_pDockBar->RemoveCommandBar(pBar); pBar->m_pDockBar = NULL; } pBar->m_barPosition = xtpBarFloating; return TRUE; } [/code]
So I will be notified about a changing layout via OnSize, but I can't realign my controls because I don't have the actual state of Toolbar (it says it is already docked top, left, ...) I think its wrong to set the new state (blue line) after generating the message WM_SIZE. What do you mean? Thanks for your opinion. |
||||
![]() |
||||
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 23 September 2009 at 3:49am |
|||
|
Hi, Do you have your toolbars inside some frame or simple dialog?
strange - if its frame last line have not to be executed, if its dialog - toolbar can't be floated.
you can check if pToolBar->GetDockBar() return NULL - it means toolbar is floated.
|
||||
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
||||
![]() |
||||
Michl
Senior Member
Joined: 14 September 2007 Status: Offline Points: 138 |
Post Options
Thanks(0)
Quote Reply
Posted: 23 September 2009 at 5:50am |
|||
|
We use it inside a dialog. And it works fine...
(inclusive floating) Was it not planned to work inside dialogs??? You have right.
pFrame is NULL in dialogs, so the else-case is executed. Your're idea (to check GetDockBar() before I call GetPosition()) I already tried. But the problem is, so I get an flicker effect! (try to move a Toolbar inside a command bar. So OnSize will be called twice. First with GetDockBar() == NULL and second with GetDockBar() != NULL) If I move the line, everything works fine...
But I think for compatibility that's the better solution:
Thats's my code. Or do you have a better way to resolve this problem? ![]()
|
||||
![]() |
||||
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 23 September 2009 at 8:54am |
|||
|
better call RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, reposQuery, rcClientNow);to get current client rect.
|
||||
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
||||
![]() |
||||
Michl
Senior Member
Joined: 14 September 2007 Status: Offline Points: 138 |
Post Options
Thanks(0)
Quote Reply
Posted: 23 September 2009 at 10:08am |
|||
|
Okay. This code looks nicer.
![]()
But this doesn't solve the problem if anyone likes to detect the current state in OnSize of a toolbar? Now, you never get the information about the toobar floating state. But I don't know if anyone would use/is missing this functionality... |
||||
![]() |
||||
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |