Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Enable/Disable items when Ribbon is Minimized
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Enable/Disable items when Ribbon is Minimized

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


Joined: 08 February 2008
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote H2Os Quote  Post ReplyReply Direct Link To This Post Topic: Enable/Disable items when Ribbon is Minimized
    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.
 
 
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: 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
Back to Top
H2Os View Drop Down
Newbie
Newbie


Joined: 08 February 2008
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote H2Os Quote  Post ReplyReply Direct Link To This Post 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
 
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.