[Gambas-user] How to create an array of checkbox?

vuott at tutanota.com vuott at tutanota.com
Mon Sep 25 23:32:16 CEST 2023


You can also directly use an array of "CheckBox":    CheckBox[...]


You can also avoid using an array, though:

[code]
Public Sub Form_Open()
 
  Dim cb As CheckBox
  
  For b As Byte = 0 To 3
    With cb = New CheckBox(Me) As "CheckCheck"
      .X = (b + 1) * 50
      .Y = 100
      .W = 20
      .H = 10
      .Name = "CheckBox n. " & CStr(b)
    End With
  Next
 
End

Public Sub CheckCheck_MouseDown()
 
  Print Last.Name
 
End [/code]



25 set 2023, 21:18 da roberto.premoli at tiscali.it:

> Il 25.09.2023 20:11 T Lee Davidson ha scritto:
>
>> On 9/25/23 13:53, roberto.premoli at tiscali.it [1]wrote:
>>
>>> Hello,i using checbox, 16 checboxez, form check01 to check16. i manage
>>> it individually position, value, text, etc. Now program need to be
>>> expandedto 64 (maybe 128 in future) checkbox. To hndle manually is a
>>> pain, with high risk to do human misake in copy/paste of code. I need
>>> an array like check(index 0 to 63). I know is not possible to do in
>>> IDE, but i dont know ho tto do in code. I tied to search in gambaswiki
>>> without find so i came here to ask. A little example will be greatly
>>> apprecated howto create an array of checkbox. thanks, Roberto
>>>
>>
>> Maybe Object[] will do what you need:
>> https://gambaswiki.org/wiki/comp/gb/object[] [2]
>>
>> -- Lee ----[ http://gambaswiki.org/wiki/doc/netiquette [3] ]----
>>
>
>
> Links:
> ------
> [1] mailto:roberto.premoli at tiscali.it
> [2] https://gambaswiki.org/wiki/comp/gb/object[]
> [3] http://gambaswiki.org/wiki/doc/netiquette
>
>
> it works, craete an array of check box. but now how can i interact with that? if i draw a checbbox in code, then i have therlative action (mousedown,  etc) that i can fill with my code , bit with this dinamically created objec,s where can i wrote te relative cod tu react to actions on them?
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230925/4d98b30f/attachment.htm>


More information about the User mailing list