![]() |
CXTPToolbar in ActiveX dialog |
Post Reply ![]() |
Author | |
kram617 ![]() Newbie ![]() Joined: 24 February 2006 Status: Offline Points: 12 |
![]() ![]() ![]() ![]() ![]() Posted: 18 June 2008 at 3:48pm |
Hello,
I currently have an ActiveX control which launches a popup dialog. On the popup dialog, I have an CXTPToolbar. The problem I am having is that the toolbar buttons are all showing up as enabled, even though my OnUpdateCmdUI handlers may specify otherwise. In addition, once I click a toolbar button, it stays pushed in (as if the CHECK property was turned on). My OnUpdateCmdUI handlers are definitely being called, but for some reason the toolbar is ignoring the enabled/checked button states.
What's interesting is I also use a CXTPToolbar on the child window that rests directly on the COleControl, and everything is working fine there. It's only the popup dialog where I seem to be having a problem.
Any ideas? Thanks
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Modal Dialog don't call OnUpdateCmdUI . you need manually call it:
ON_MESSAGE(WM_KICKIDLE, OnKickIdle)
LRESULT CDialogSampleDlg::OnKickIdle(WPARAM, LPARAM)
{ if (GetCommandBars()) GetCommandBars()->UpdateCommandBars(); if (m_wndStatusBar.GetSafeHwnd()) m_wndStatusBar.SendMessage(WM_IDLEUPDATECMDUI, TRUE); return 0; } |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
kram617 ![]() Newbie ![]() Joined: 24 February 2006 Status: Offline Points: 12 |
![]() ![]() ![]() ![]() ![]() |
Oleg,
I think there is some confusion. I am already receiving the OnUpdateCmdUI messages. The problem I have is that the UI is not being updated to reflect my changes. The pCmdUI->Enable(false) calls are being ignored, even though I can step through the code in DEBUG to verify the line is being reached. Thanks |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Have to work. Attach not working sample, I will show what you do wrong.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
kram617 ![]() Newbie ![]() Joined: 24 February 2006 Status: Offline Points: 12 |
![]() ![]() ![]() ![]() ![]() |
Here is the sample code:
TestApp is the application and TestControl is the OCX. You will notice the main window correctly has the first four toolbar buttons enabled and the rest disabled. However, the popup windows wrongly enable all toolbar buttons. Plus, the buttons get stuck when you click them.
This is v9.70 of Xtreme Toolkit Pro.
Thanks for your help.
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
As I wrote problem with WM_IDLEUPDATECMDUI - your main dialog receives it, but child not.
Add this:
ON_MESSAGE(WM_IDLEUPDATECMDUI, OnIdleUpdate)
LRESULT CTestDlg::OnIdleUpdate(WPARAM wParam, LPARAM lParam)
{ for (int i = 0; i < m_array.GetSize(); i++) { CBrowserDlg* pBrowser = (CBrowserDlg*)m_array; pBrowser->SendMessageToDescendants(WM_IDLEUPDATECMDUI, TRUE); } return 0; } |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
kram617 ![]() Newbie ![]() Joined: 24 February 2006 Status: Offline Points: 12 |
![]() ![]() ![]() ![]() ![]() |
Thanks, that fixed the problem.
What confused me is that my ON_UPDATE_COMMAND_UI handlers were getting called all along, but the UI was never being updated. Apparently, forwarding the WM_IDLEUPDATECMDUI from the topmost control window is enough to receive the ON_UPDATE_COMMAND_UI, but it doesn't actually update the UI. The UI changes won't take affect unless each individual popup window is manually forwarded WM_IDLEUPDATECMDUI.
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
It never called. You saw WM_IDLEUPDATE of main dialog - not child.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
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 |