[Gambas-user] ToggleButton issue

Gianluigi bagonergi at gmail.com
Sat Feb 19 14:32:29 CET 2022


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220219/39d89d86/attachment.htm>


More information about the User mailing list