When using the OBJECT DUPLICATE command, the positioning of the layering of the object can be controlled during the creation. This is done by knowing the current layering positions of all of the objects on the form. When an object is created with the OBJECT DUPLICATE command and the bound parameter (4th parameter) is not passed the object is automatically placed on the front most level of the form, meaning it will be on top of every other object and the last object in an entry tab sequence. To control the level of a newly created object, pass the object that will be the layer just under the new object as the bound parameter. This will place the new object on the next layer.
So if object "A" is in the 4th layer, passing this object as the bound paramter for a new object will place the new object as the 5th layer and every subsequent layer will increase by one and be placed on top of the new layer.
For example placing a 50x50 pixel button in the upper left side of a form:
Sample Code 1:
C_LONGINT($i) For ($i;1;10) OBJECT DUPLICATE(*;"button";"button"+String($i);($i*25);($i*25)) OBJECT SET TITLE(*;"button"+String($i);String($i)) End for |
With each object not bounded, it will be placed on the newest Level thus.
Sample Code 2:
C_LONGINT($i) For ($i;1;10) OBJECT DUPLICATE(*;"button";"button"+String($i);"button";($i*25);($i*25)) OBJECT SET TITLE(*;"button"+String($i);String($i)) End for |
With each object bounded to the initial object they will be placed on level 2 and every other object that was on level 2 and above will get shifted up.
OBJECT DUPLICATE Documentation:
http://livedoc.4d.com/4D-Language-Reference-15.1/Objects-Forms/OBJECT-DUPLICATE.301-2685651.en.html