Print Page | Close Window

CXTPToolbar in ActiveX dialog

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=11098
Printed Date: 01 March 2025 at 12:32am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPToolbar in ActiveX dialog
Posted By: kram617
Subject: CXTPToolbar in ActiveX dialog
Date 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



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


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


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


Posted By: kram617
Date Posted: 23 June 2008 at 5:12pm
Here is the sample code:
 
https://forum.codejock.com/uploads/20080623_171609_TestControl.zip - uploads/20080623_171609_TestControl.zip http://uploads/temp/20080623_170408_TestControl.zip -
 
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.


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


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


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



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