Howdy,
I'm trying to implement a RadioControl list in a pop-up menu (the sad fact is that I can implement it fine as a ComboBox in the Ribbon, but its companion object, which I implemented as a pop-up Treeview, would not render properly and there is no companion Event to InitCommandsPopup so I had to switch to doing it on a menu) but since CommandBars will not manage the state itself I'm trying to unsuccessfully. All I'm trying to do it make the items works like a radio control, so only the newly selected item is "checked", but FindControl is failing.
Here is how the menu is built:
Set ControlPopup = ControlOptions.CommandBar.Controls.Add(xtpControlPopup, ID_SVR_SOURCE, "Source Server", -1, False) Set Control = ControlPopup.CommandBar.Controls.Add(xtpControlRadioButton, ID_SVR_SOURCE_CONTENT, "Content Editor", -1, False) Control.Checked = True Set Control = ControlPopup.CommandBar.Controls.Add(xtpControlRadioButton, ID_SVR_SOURCE_NS1, "NS1", -1, False) Control.BeginGroup = True ControlPopup.CommandBar.Controls.Add xtpControlRadioButton, ID_SVR_SOURCE_TESTPAK, "TestPak", -1, False ControlPopup.CommandBar.Controls.Add xtpControlRadioButton, ID_SVR_SOURCE_TRYSTARS, "TryStars", -1, False ControlPopup.CommandBar.Controls.Add xtpControlRadioButton, ID_SVR_SOURCE_SUPPORT, "Support", -1, False
Here is the code inside the Execute event:
Case ID_SVR_SOURCE_CONTENT, ID_SVR_SOURCE_NS1, ID_SVR_SOURCE_TESTPAK, ID_SVR_SOURCE_TRYSTARS, ID_SVR_SOURCE_SUPPORT Set FoundControl = CommandBars.FindControl(, ID_SVR_SOURCE_CONTENT) If Not FoundControl Is Nothing Then FoundControl.Checked = False End If Set FoundControl = CommandBars.FindControl(, ID_SVR_SOURCE_NS1) If Not FoundControl Is Nothing Then FoundControl.Checked = False End If Set FoundControl = CommandBars.FindControl(, ID_SVR_SOURCE_TESTPAK) If Not FoundControl Is Nothing Then FoundControl.Checked = False End If Set FoundControl = CommandBars.FindControl(, ID_SVR_SOURCE_TRYSTARS) If Not FoundControl Is Nothing Then FoundControl.Checked = False End If Set FoundControl = CommandBars.FindControl(, ID_SVR_SOURCE_SUPPORT) If Not FoundControl Is Nothing Then FoundControl.Checked = False End If Control.Checked = True
However the control is never found. I use this same code to find a CheckBox item on the ribbon to activate/deactivate an associated control:
Case ID_CW_STARTDATE_CAPTION Control.Checked = Not Control.Checked Set FoundControl = CommandBars.FindControl(, ID_CW_STARTDATE) If Not FoundControl Is Nothing Then FoundControl.Enabled = Not FoundControl.Enabled End If
Anyone know what is going on or a better way to control the active Radio selection?
------------- Chris Rowley
|