N
Neil Humphries
I must be missing something basic. I am trying to program a togglebutton to
change labels based on whether it is pressed or not, but can't get it to
work. As long as MyRibbon is valid, nothing changes. If because of editting
VBA MyRibbon becomes invalid the button shows its toggled state. This is the
code I am using:
'Callback for tButMAXAdmin00 onAction
Sub MinimizeMaxAdminRFPBar(control As IRibbonControl, ByVal pressed)
MyPressed = pressed
If (Not MyRibbon Is Nothing) Then
MyRibbon.InvalidateControl ("tButMAXAdmin00")
End If
End Sub
Sub getVisible(control As IRibbonControl, ByRef visible)
MyTag = "TDRFP"
'if max/min button pressed
If control.Tag = "show" Then
visible = True
'toggle visibility of other controls in same group
If control.Tag Like MyTag Then
visible = Not (visible)
End If
End If
End Sub
Sub getLabel(control As IRibbonControl, ByRef label)
Select Case control.ID
Case Is = "cButMAXAdmin99"
'this doesn't work because label is undefined when passed ByRef
If label = "Minimize Group" Then
label = "Maximize Group"
Else
label = "Minimize Group"
End If
Case Is = "tButMAXAdmin00"
If MyPressed Then
label = "Maximize Group"
Else
label = "Minimize Group"
End If
Case Else
'do nothing
End Select
End Sub
Sub getPressed(control As IRibbonControl, ByRef toggleState)
Select Case control.ID
Case Is = "tButMAXAdmin00"
MyPressed = Not (MyPressed)
Case Else
'do nothing
End Select
toggleState = MyPressed
End Sub
If I want to use the togglestate of this button to control the visibility of
other controls in the same group, how do I iterate through the other controls
and can I manipulate the visible attribute directly or do I have to use
getVisible in the XML for the control?
change labels based on whether it is pressed or not, but can't get it to
work. As long as MyRibbon is valid, nothing changes. If because of editting
VBA MyRibbon becomes invalid the button shows its toggled state. This is the
code I am using:
'Callback for tButMAXAdmin00 onAction
Sub MinimizeMaxAdminRFPBar(control As IRibbonControl, ByVal pressed)
MyPressed = pressed
If (Not MyRibbon Is Nothing) Then
MyRibbon.InvalidateControl ("tButMAXAdmin00")
End If
End Sub
Sub getVisible(control As IRibbonControl, ByRef visible)
MyTag = "TDRFP"
'if max/min button pressed
If control.Tag = "show" Then
visible = True
'toggle visibility of other controls in same group
If control.Tag Like MyTag Then
visible = Not (visible)
End If
End If
End Sub
Sub getLabel(control As IRibbonControl, ByRef label)
Select Case control.ID
Case Is = "cButMAXAdmin99"
'this doesn't work because label is undefined when passed ByRef
If label = "Minimize Group" Then
label = "Maximize Group"
Else
label = "Minimize Group"
End If
Case Is = "tButMAXAdmin00"
If MyPressed Then
label = "Maximize Group"
Else
label = "Minimize Group"
End If
Case Else
'do nothing
End Select
End Sub
Sub getPressed(control As IRibbonControl, ByRef toggleState)
Select Case control.ID
Case Is = "tButMAXAdmin00"
MyPressed = Not (MyPressed)
Case Else
'do nothing
End Select
toggleState = MyPressed
End Sub
If I want to use the togglestate of this button to control the visibility of
other controls in the same group, how do I iterate through the other controls
and can I manipulate the visible attribute directly or do I have to use
getVisible in the XML for the control?