Cumulonimbus wrote:I did miss it. Thank you very much, it works now even with the while loop.
Just out of curiosity, because I don't get it:
object = getfirst(Container) gets the first object in the Container, which is a Knob object.
It seems to me that object = getnext(object) would then get the next object in the Knob, which isn't meaningful.
It works, but I don't see why...
It really comes down to how Lemur stores the references to the objects internally. If you think of the objects in a Container as links of a chain, then what you do when you say getfirst(Container) is to return the whole chain, with your hand holding the first link. Getnext(object) starts where you are holding the chain and moves to the next link. If you say getnext(Container) you are saying give me the next link starting from Container, which is going to always return the first link only.
You can play around with it by creating another Container inside the first one between the knobs (change knob2 name to knob3 and create a container called knob2) and see what happens. If you print the object name out (create a Monitor object and insert: Monitor.value = getattribute(object, 'name'); after a getnext(object) call, you will see that in fact knob1 is returned first, then knob2 (which is a container), then knob 3. If you embed another object in the new container (say another knob inside your knob2 container), you can't get to it using getnext(). Conceptually, it's like another small chain hanging down from one of the middle links and you can only traverse one chain at a time. You would need to do a getfirst(knob2) to start walking through those links.
I don't see any obvious way to be able to distinguish between objects other than by some attribute you set (i.e. - compare name, color, position, etc), so either you have to construct the objects in the way you want or do lots of checking after every return from getnext().