hi all,
hoping someone can help me out with this problem i am having.
now i have some control containers i am putting on a canvas. the amount could be anything. and so far there are 6 different ones i put in.
no i am trying to figure out how i can access them. get the values of some on the controls in there and so on.
i have looked into adding the controlcontainers i make each time to an array. but please correct me if i am wrong, but this is not possible.
now control sets seem to do what i want. but each controlcontainer i have has a fair few items in them so it would become a big task to keep adding each control set.
is it possible at all to get the list of controlcontainers and then access each item in them? thanks.
As a first test, put this in the open event of your window (the code assumes your Canvas has the name “Canvas1”):
For i As Integer = 0 To ControlCount - 1
If Control(i) IsA RectControl Then
Dim rc As RectControl = RectControl(Control(i))
If rc IsA EmbeddedWindowControl And rc.Parent = Canvas1 Then
// We have one of the EmbeddedWindowControl representing a ContainerControl in Canvas1
Dim ewc As EmbeddedWindowControl = EmbeddedWindowControl(rc)
Dim oi As Runtime.ObjectIterator = Runtime.IterateObjects()
Do Until Not oi.MoveNext()
If oi.Current IsA ContainerControl Then
// We have one of the ContainerControls in Canvas1
Dim cc As ContainerControl = ContainerControl(oi.Current)
If cc.Handle = ewc.Handle Then
// We have the ContainerControl represented by the EmbeddedWindowControl
For j As Integer = 0 To cc.ControlCount - 1
Dim c As Control = cc.Control(j)
// We have one of the Controls in one of the ContainerControls in Canvas1
...
Next
End
End
Loop
End
End
Next
There is a feature request to have a property on the EmbeddedWindowControl for the Container it embeds.
Please add yourself there: 23030
For now I keep myself an array of all the containers I create to have such reference myself.
got it to work perfectly…
i have a property in my window rows(-1) as ContainerControl1
i create it as such:
dim row as new ContainerControl1
rows.Append(row)
row.EmbedWithin(Canvas1,10,controlcount)
controlcount=controlcount+70
and add it to my rows property.
and then to loop through them all and get the value of a control in them…
for i as Integer=0 to UBound(rows)
MsgBox(rows(i).TextField1(0).Text)
next
works perfect