| **Navigation:**  [[introduction.htm|Language Reference]] > 13 - Built-in Functions >====== SETPOSITION (specify new control position) ====== | [[setpenwidth set line draw thickness .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[settarget set current window or report .htm|{{btn_next_n.gif|Next page}}]] | | || {{newc7.jpg|NewC7.jpg}} **SETPOSITION(|** //control// |[,//x// ] [, //y// ] [,// width// ] [,// height //] **)** **| **//target//** |** {{blk2blue.jpg|blk2blue.jpg}} | **SETPOSITION** | Dynamically specifies the position and size of an APPLICATION, WINDOW, REPORT, or control. | | //control// | A field number or field equate label for the control to affect. If //control// is zero (0), it specifies the window. | | //target// | The label of an APPLICATION, WINDOW, or REPORT structure, or a reference to any of those structures. | | //x// | An integer constant, expression, or variable that specifies the horizontal position of the top left corner. If omitted, the //x// position is not changed. | | //y// | An integer constant, expression, or variable that specifies the vertical position of the top left corner. If omitted, the //y// position is not changed. | | //width// | An integer constant, expression, or variable that specifies the width. If omitted, the //width// is not changed. | | //height// | An integer constant, expression, or variable that specifies the height. If omitted, the //height// is not changed. | **SETPOSITION** dynamically specifies the position and size of an APPLICATION, WINDOW, REPORT, or control. If any parameter is omitted, the value is not changed. The //window// parameter is used to set the position and/or dimensions of a window that currently is not on top or has focus. The values contained in the //x//, //y//, //width//, and //height// parameters are measured in dialog units. Dialog units are defined as one-quarter the average character width by one-eighth the average character height. The size of a dialog unit is dependent upon the size of the default font for the window. This measurement is based on the font specified in the FONT attribute of the window, or the system default font specified by Windows. Using SETPOSITION produces a "smoother" control appearance change than using property expressions to change the AT attribute's parameter values. This is because SETPOSITION changes all four parameters at once. Property expressions must change one parameter at a time. Since each individual parameter change would be immediately visible on screen, this would cause the control to appear to "jump." **Example:** **    CREATE(?Code4Entry,CREATE:entry,?Ctl:Code)  !Create a control** **    ?Code4Entry{PROP:use} = 'Code4Entry'        !Set USE variable** **    ?Code4Entry{PROP:text} = '@s10'             !Set entry picture** **    GETPOSITION(?Ctl:Code,X,Y,Width,Height)     !Get Ctl:Code position** **    SETPOSITION(?Code4Entry,X+Width+40,Y)       !Set x 40 past Ctl:Code** **    UNHIDE(?Code4Entry)                         !Display the new control** **See Also:** [[getposition get control position .htm|GETPOSITION]] [[prop pixels.htm|PROP:Pixels]]