Xojo 2023R3 - it appears that Control Arrays are not supported. Anyone know when this might change?
Is there an alternative method especially when loading or saving I have always used a For Next loop such as:
For i As Integer = 1 To 11
CmbStart(n).AddRow Cstr(i) + ":00" ' AM"
CmbStart(n).AddRow Cstr(i) + ":15" ' AM"
CmbStart(n).AddRow Cstr(i) + ":30" ' AM"
CmbStart(n).AddRow Cstr(i) + ":45" ' AM"
You can create a control subclass and use it to locate controls of this group for example
Var n As Integer = 0
For Each cntrl As WebUIControl In Self.Controls
If cntrl IsA MyTextField Then
n = n + 1
MyTextField(cntrl).Caption = "Init "+n.ToString
Thank you! That looks like a really easy and elegant method.
I made a Feature Request last year: https://tracker.xojo.com/xojoinc/xojo/-/issues/70810
But there is another one that is more than 2 years old:
Looks like that someone at xojo cant understand why users want Control Arrays, so dont hold your breath on this. Web2 is still feature incomplete, Im still on web1 for now.
A few questions
@ Rick A - When wanting to read the value of a WebPopupMenu, and there are more than what you want to read at this time, how to identify them?
@ Ivan Tellez thank you also for responding. I suppose we can hope!
when playing with webpopupmenus (and other menus) you always have the rowtag property where you can store a unique id to identify the line that was choosen.
Hi Jean-Yves Pochez
There’s no row tag property available on WebPopupMenus - at least not in 2023R3 or 3.1
Wish this was simpler, like the good ole days!
Uh, where did you get that idea?
WebPopupMenu.RowTagAt is both in the documentation and autocomplete.
Maybe it was my confusion, but the “RowTag” only identifies the line the was chosen. In this case, it needs to ID the WebPopupMenu object itself. I saw no way to do that - ie set a property to each WebPopupMenu - not it’s contents. Similar to having an array of WebPopupMenus like in Web1
You could do something like this, but you should probably revisit your design if this achieves what you want:
// The items in the array are WebPopupMenus on the WebPage
var aroMenus() as WebPopupMenu = Array(WebPopupMenu1, WebPopupMenu2, WebPopupMenu3)
for each oMenu as WebPopupMenu in aroMenus
for i as Integer = 1 to 11
oMenu.AddRow(i.ToString + ":00")
oMenu.AddRow(i.ToString + ":15")
oMenu.AddRow(i.ToString + ":30")
oMenu.AddRow(i.ToString + ":45")
A TimeMenu subclass would be recommended, or finding some better way to enter times. The way Indeed has you select availability is an absolute pain.
Assigning is relatively easy. Its reading the values of each that are a PIA.
Your reference to TimeMenu Subclass - is this a subclass that I would create
Rick gave you a pretty good answer. Make a subclass and use it only for the controls you want in the controlarray. If you want a different control array, create another subclass. Then you can loop through all the controls and identify which ones are in the control array by examing their control type.
Yes, I will be looking into that.