Hello,
I created a menu with few Menu "statebutton".
File
--> Menu Checked 1
--> Menu Checked 2
I would like : When I click on the menu "Menu Checked 1" that a value is "True" and the "Menu Checked 2" is False...etc...
When I can to do ? Have you a sample code in Vb.Net ?
Regards,
Rom76,
Try handling the UltraToolbarsManager's ToolClick event and use code like the following:
Private Sub UltraToolbarsManager1_ToolClick(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinToolbars.ToolClickEventArgs) Handles UltraToolbarsManager1.ToolClick If e.Tool.Key = "StateButtonTool1" Then Dim stateButton1 As StateButtonTool = CType(e.Tool, StateButtonTool) Dim stateButton2 As StateButtonTool = CType(e.Tool.ParentCollection("StateButtonTool2"), StateButtonTool) stateButton2.Checked = Not stateButton1.Checked ElseIf e.Tool.Key = "StateButtonTool2" Then Dim stateButton2 As StateButtonTool = CType(e.Tool, StateButtonTool) Dim stateButton1 As StateButtonTool = CType(e.Tool.ParentCollection("StateButtonTool1"), StateButtonTool) stateButton1.Checked = Not stateButton2.Checked End If End Sub
Hope this helps,
~Kim~
Kim,
Thank you for your response....
I tried your program :
Private
Sub MenuPrincipal_ToolClick(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinToolbars.ToolClickEventArgs) Handles MenuPrincipal.ToolClick
Select Case e.Tool.Key
Case "Option1"
Dim stateButton1 As Infragistics.Win.UltraWinToolb***ateButtonTool = CType(e.Tool, Infragistics.Win.UltraWinToolb***ateButtonTool)
Dim stateButton2 As Infragistics.Win.UltraWinToolb***ateButtonTool = CType(e.Tool.ParentCollection("Option2"), Infragistics.Win.UltraWinToolb***ateButtonTool)
stateButton2.Checked =
Not stateButton1.Checked
Case "Option2"
Dim stateButton2 As Infragistics.Win.UltraWinToolb***ateButtonTool = CType(e.Tool.ParentCollection("Option1"), Infragistics.Win.UltraWinToolb***ateButtonTool)
End Select
End Sub
I'm not understand, I'm not see in my menu the "check" on the menu ?
Have you got a sample in VB.Net
Thank you.
I'm not exactly sure what you are looking for. I've attached a simple sample. When you run it and click on one of the state buttons, a checkmark appears next to it. What are you seeing and what are you expecting?
Thank you for your help...
I tried your sample, but I'm not see the check (See you in my file sample JPG).
Why I can't see the symbol check ?
Thank You.
Romuald
Romuald,
Make sure you have each StateButtonTool's MenuDisplayStyle property set to StateButtonMenuDisplayStyle.DisplayCheckmark.
It's works !!!! Very good....
But, can you set for example "option1" is checked in my form event Load....I want set for example by default...
Thank you for your help.
I tried your sample code and it's work !!!
I'm not see that I must call the collection "popupTool" !!!!
Thank you very much...and your answer is very speed !!!
Romauld,
You will have to get a reference to the StateButtonTool in your Form_Load event and then set its Checked property to true. Your code might look something like:
Dim popupTool as PopupMenuTool = CType(me.UltraToolbarsManager.Toolbars(0).Tools("PopupMenuTool1"), PopupMenuTool)
Dim sTool as StateButtonTool = CType(popupTool.Tools("StateButtonTool1"), StateButtonTool)
sTool.Checked = true