[Gambas-user] ToggleButton issue

Charlie Ogier charlie at cogier.com
Sat Feb 19 15:13:54 CET 2022


Hi Gianluigi,

That is very neat and does what I want. (I just changed Value to Enabled)

Thank you,

Charlie

On 19/02/2022 13:32, Gianluigi wrote:
> Hi Charlie,
>
> after what was written in this discussion by Benoit:
> https://lists.gambas-basic.org/pipermail/user/2018-April/063832.html
> I divide the Actions with a hyphen.
> (Remember that you can assign shortcuts with the Action Configure method)
> To follow, your example with added tips and a trick:
>
> Regards
> Gianluigi
>
> Public Sub Form_Open()
>
>   Dim hToggle As ToggleButton
>   Dim iLoop As Integer
>   Dim hButton As Button
>
>   With Me
>     .Arrangement = Arrange.Vertical
>     .Padding = 5
>     .W = 150
>     .H = 190
>   End With
>
>   For iLoop = 0 To 4
>     With hToggle = New ToggleButton(Me) As "AllToggles"
>       .H = 30
>       '.W = 100
>       .Text = "Click me!"
>       .Font.Bold = True
>       .Picture = Picture["icon:/22/right"]
>       .Action = "setup-" & CStr(iloop + 1) ''This is the line that 
> causes the problem (not now)
>       .Name = "ToggleButton" & CStr(iloop + 1)
>     End With
>   Next
>   With hButton = New Button(Me) As "Button1"
>       .H = 30
>       .Text = "RESET"
>       .Font.Bold = True
>     End With
>
> End
>
> Public Sub AllToggles_Click()
>
>   Print Last.Name & " = " & Str(Last.Value)
>   Action[Last.Action].Picture = Picture["icon:/22/ok"]
>
> End
>
> Public Sub Button1_Click()
>
>   Action["setup-*"].Value = False
>   Action["setup-*"].Picture = Picture["icon:/22/right"]
>
> End
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----



More information about the User mailing list