Purpose
Create a variable number of elements with dynamically calculated screen coordinates

This is useful for particular screen layouts where the number of elements depends on the application data.
Solution
Use GuiXT variables as screen coordinates

Example
We want to display a tabular overview showing customer shipping data per sales area. For a large number of sales areas the most obvious design is to use a table with one row per sales area. If we know that only a relatively small number of sales areas can exist for each customer, for example at most 12, a horizontal design is a more user friendly alternative;






GuiXT Script 

Offset (4,10)

// customer number
InputField (0,3) "Customer" (0,15) size=10 name="kunnr" _
 
techname="KNA1-KUNNR" -uppercase

Text (3,3) "Sales area"
Text (4,3) "Delivery Priority"
Text (5,3) "Shipping Conditions"
Text (6,3) "Delivery Plant"

// read sales area data from table KNVV
Clear text[r]

Call "/guixt/dbselect" in.TABLE="KNVV" _
 
in.CONDITION="KUNNR = @KUNNR AND SPART = '00'" _
 
in.DOMNAME1="KUNNR" in.DOMVALUE1="&V[kunnr]" _
  in.FIELDS="VKORG,VTWEG,LPRIO,VSBED,VWERK" _
  in.ORDERBY="VKORG,VTWEG" _
 
table.VALUES="r"

// field index
Set
V[k] 0

// dynamic column

Set
V[n] 20

label next_salesarea
Set V[k] &V[k] + 1

CopyText fromText="r" toString="vkorg" line="&V[k]"
if Q[ok]
   Set V[k] &V[k] + 1
 
CopyText fromText="r" toString="vtweg" line="&V[k]"
   Set V[k] &V[k] + 1
 
CopyText fromText="r" toString="lprio" line="&V[k]"
 
Set V[k] &V[k] + 1
 
CopyText fromText="r" toString="vsbed" line="&V[k]"
 
Set V[k] &V[k] + 1
 
CopyText fromText="r" toString="vwerk" line="&V[k]"

  Text (3,&V[n]) "&V[vkorg]/&V[vtweg]"

  InputField (4,&V[n]) size=2 name="lprio" -nolabel -readonly
  InputField (5,&V[n]) size=2 name="vsbed" -nolabel -readonly
  InputField (6,&V[n]) size=4 name="vwerk" -nolabel -readonly

  Set V[n] &V[n] + 9
  goto next_salesarea
endif

// Group box around all fields
Box (2,2) (7,&V[n]) "Shipping info per sales area"

Components
InputAssistant + Controls