Print Page | Close Window

Enable/Disable items when Ribbon is Minimized

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=9537
Printed Date: 17 June 2025 at 10:43pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Enable/Disable items when Ribbon is Minimized
Posted By: H2Os
Subject: Enable/Disable items when Ribbon is Minimized
Date Posted: 08 February 2008 at 10:39am
Hi
 
Have been using the CommandBar 11.2.0 with ribbon style for a week or so now - makes our app look really sweet!
 
But, I have found a reproducible problem...
 
Take the VB6 RibbonMDISample app, add a check box to frmDocument and add the following code in the _Click event:
 
    Dim p_CommandControl As CommandBarControl
    Set p_CommandControl = fMainForm.CommandBars.FindControl(, ID_EDIT_SELECT, , True)
    p_CommandControl.Enabled = (Check1.Value = vbChecked)
 
Run the app and you will see that the Select button on the Edit tab enables and disables as expected.
 
Now click "Minimize the Ribbon" from the QAT, then click the Edit tab to make the ribbon popup. From now on, clicking the check box has no effect on the button at all, whether it is minimized or not.
 
 
There is a way round this, and that is to use Actions, but as I will only ever have one instance of an ID there seems little point in defining an action for each ID I want to be able to enable/disable.
 
 



Replies:
Posted By: Oleg
Date Posted: 08 February 2008 at 2:52pm
Hi,
You need use Actions or Update handlers.  FindControl is evil - using this way you will not update control in minimized ribbon or control that was added to QAT.
Actions is solution for you - it will update all instances with same Id:
 
fMainForm.CommandBars.Actions(ID_EDIT_SELECT).Enabled = False

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: H2Os
Date Posted: 11 February 2008 at 8:37am
Thanks Oleg
 
Are you saying that FindControl shouldn't be used at all? What appens if one control affects another?
 
e.g. I have a combo box and some buttons which move the current selected item to first/previous/next /last - when the button is clicked how should I find the combo box?
 
 
Thanks
 



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