Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - CXTPToolbar in ActiveX dialog
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPToolbar in ActiveX dialog

 Post Reply Post Reply
Author
Message
kram617 View Drop Down
Newbie
Newbie


Joined: 24 February 2006
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote kram617 Quote  Post ReplyReply Direct Link To This Post Topic: CXTPToolbar in ActiveX dialog
    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
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: 19 June 2008 at 1:18am
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
Back to Top
kram617 View Drop Down
Newbie
Newbie


Joined: 24 February 2006
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote kram617 Quote  Post ReplyReply Direct Link To This Post Posted: 23 June 2008 at 3:20pm
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
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: 23 June 2008 at 3:49pm
Have to work. Attach not working sample, I will show what you do wrong.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
kram617 View Drop Down
Newbie
Newbie


Joined: 24 February 2006
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote kram617 Quote  Post ReplyReply Direct Link To This Post Posted: 23 June 2008 at 5:12pm
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.
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: 24 June 2008 at 1:13am
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
Back to Top
kram617 View Drop Down
Newbie
Newbie


Joined: 24 February 2006
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote kram617 Quote  Post ReplyReply Direct Link To This Post Posted: 24 June 2008 at 11:08am
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.
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: 24 June 2008 at 3:10pm
Hi,
 
It never called. You saw WM_IDLEUPDATE of main dialog - not child.
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.156 seconds.