[Gambas-user] Adressing a self-made object
Alain Baudrez
a.baudrez at ...626...
Thu Oct 24 14:07:14 CEST 2013
Hello,
I have been trying to emulate the VB.NET listbox control with checkboxes. I
use this code to create and display them in a scrollview:
[code]
' Declare a checkbox
Private hCheckbox As CheckBox
' Create instances ofthe checkbox and place them
' in the parent Scrollview called ScrollFunction
'
Private Sub FillScrollBox()
Dim vPos As Integer = 1 ' Counter representing the nth item
$rs = $db.Exec("SELECT * FROM tblListFunctie")
For Each $rs
hCheckbox = New CheckBox(ScrollFunction)
With hCheckbox
.x = 10
.y = (vPos - 1) * hCheckbox.Height + 5
.width = 150
.text = $rs!Function
.tag = $rs!ID
End With
Inc vPos
Next
End
[/code]
All checkboxes are displayed in the ScrollView, but how do I address any of
those checkboxes?
I need to be able to set/read the value of those checkboxes. I tried :
hCheckbox = New CheckBox(ScrollFunction) AS "chkScroll" & vPos
but I cannot address the object chkScroll1
chkScroll1.value = TRUE
returns an 'Unknown Identifier'
Moreover, I don't know how many checkboxes I created. Yes, I could keep
track of the variable vPos and use that, but is there a generic way to loop
through only the checkboxes in their parent, namely the Scrollview?
Any tips are welcome
A.J.
More information about the User
mailing list