Page 1 of 1

Groups and children

Posted: Wed Jun 12, 2024 3:59 pm
by GMKai
Is there a way to get to now during runtime what children are existing?

Code: Select all

<statusbar>
				<item id="first" width="20"/>
				<item id="second"/>
			</statusbar>
How can Statusbar examined to get to know the count and ID of it's children?

Re: Groups and children

Posted: Thu Jun 13, 2024 1:46 pm
by GMKai
preliminary

Code: Select all

r = moai.HaveObject(id$)
might give a "global" answer,
is there a way to iterating over a group to look up only direct children?

Re: Groups and children

Posted: Thu Jun 13, 2024 10:48 pm
by plouf
you can do "indirectly"
i.e. if you manual set naming id based in numbers and use strstr
example here status bar items id are "status_1" "status_2" and "status_3"

Code: Select all

	For i=1 To 4
		DebugPrint(moai.HaveObject("status_"..StrStr(i)))
  Next 
but wahts the point ? since status bar items are fixed during initialization and cannot changed after ?

p.s. maybe another "indirect" way is to examine window XML file ?

Re: Groups and children

Posted: Fri Jun 14, 2024 12:06 pm
by GMKai
The indirect way via gui-definition is very nice.

To still go the runtime-way, this should help:

Code: Select all

r = moai.Get(id,"Class") 
It helps to select an apropriate setter for an object