MAIN
DEFINE x,y INT,
msg CHAR(128)
OPEN WINDOW mywin AT 1,1 WITH FORM "combo" ATTRIBUTE(BORDER)
MENU
COMMAND "_clear"
CALL fgl_winprompt(5, 2, "Enter start index to clear: ", "1", 20, 0) returning x
CALL fgl_winprompt(5, 2, "Enter end index to clear: ", "1", 20, 0) returning y
MESSAGE fgl_list_clear("f1",x,y)
COMMAND "_count"
MESSAGE "There are ",fgl_list_count("f1")," items in the list"
COMMAND "_get"
CALL fgl_winprompt(5, 2, "Enter index to get item: ", "1", 20, 0) returning x
IF ( fgl_list_get("f1",x) IS NULL )
THEN
LET msg = "Item at index: ",x," not found."
ERROR msg
ELSE
LET msg = "Item value at index ",x," is: ",fgl_list_get("f1",x)
MESSAGE msg
END IF
COMMAND "_set"
CALL fgl_winprompt(5, 2, "Enter index to set item: ", "1", 20, 0) returning x
CALL fgl_winprompt(5, 2, "Enter value to set: ", "100", 20, 0) returning y
LET msg = "Item value at index ",fgl_list_set("f1",x,y)," set to: ",y
MESSAGE msg
COMMAND "_find"
CALL fgl_winprompt(5, 2, "Enter value to find: ", "1", 20, 0) returning x
LET y = fgl_list_find("f1", x)
IF y
THEN
LET msg = "Value ",x," index is: ",y
MESSAGE msg
ELSE
LET msg = "Value ",x," not found."
ERROR msg
END IF
COMMAND "_insert"
CALL fgl_winprompt(5, 2, "Enter index to insert item: ", "1", 20, 0) returning x
CALL fgl_winprompt(5, 2, "Enter value to insert: ", "100", 20, 0) returning y
LET msg = "Value ",y," inserted at index: ",fgl_list_insert("f1",x,y)
MESSAGE msg
COMMAND "_sort"
CALL fgl_winprompt(5, 2, "Enter sort order(>1 means ascending): ", "1", 20, 0) returning x
LET y = fgl_list_sort("f1", x)
IF x > 1
THEN MESSAGE "Items sorted in ascending order"
ELSE MESSAGE "Items sorted in descending order"
END IF
COMMAND "_restore"
CALL fgl_list_restore("f1")
MESSAGE "Items restored to default values"
COMMAND "EXIT"
EXIT MENU
END MENU
END MAIN
combo.fm2 code
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://namespaces.querix.com/2015/fglForms" title="New Form 1">
<form.rootContainer>
<GridPanel preferredSize="550," padding="5,5,5,5" margin="5,5,5,5" visible="true" enable="true" fieldTable="formonly" identifier="rootContainer">
<GridPanel.gridRowDefinitions>
<GridRowDefinition>
<GridRowDefinition.gridLength>
<GridLength/>
</GridRowDefinition.gridLength>
</GridRowDefinition>
</GridPanel.gridRowDefinitions>
<GridPanel.gridColumnDefinitions>
<GridColumnDefinition>
<GridColumnDefinition.gridLength>
<GridLength gridLengthType="Percent" gridLengthValue="100"/>
</GridColumnDefinition.gridLength>
</GridColumnDefinition>
</GridPanel.gridColumnDefinitions>
<ComboBox visible="true" enable="true" gridItemLocation="0,0,1,1" fieldTable="formonly" identifier="f1">
<ComboBoxItem text="1" identifier="f1_1">
<ComboBoxItem.value>
<IntegerLiteral integerValue="1"/>
</ComboBoxItem.value>
</ComboBoxItem>
<ComboBoxItem text="2" identifier="f1_2">
<ComboBoxItem.value>
<IntegerLiteral integerValue="2"/>
</ComboBoxItem.value>
</ComboBoxItem>
<ComboBoxItem text="3" identifier="f1_3">
<ComboBoxItem.value>
<IntegerLiteral integerValue="3"/>
</ComboBoxItem.value>
</ComboBoxItem>
<ComboBoxItem text="4" identifier="f1_4">
<ComboBoxItem.value>
<IntegerLiteral integerValue="4"/>
</ComboBoxItem.value>
</ComboBoxItem>
<ComboBoxItem text="5" identifier="f1_5">
<ComboBoxItem.value>
<IntegerLiteral integerValue="5"/>
</ComboBoxItem.value>
</ComboBoxItem>
<ComboBoxItem text="6" identifier="f1_6">
<ComboBoxItem.value>
<IntegerLiteral integerValue="6"/>
</ComboBoxItem.value>
</ComboBoxItem>
<ComboBoxItem text="7" identifier="f1_7">
<ComboBoxItem.value>
<IntegerLiteral integerValue="7"/>
</ComboBoxItem.value>
</ComboBoxItem>
</ComboBox>
<GridPanel.elementBorder>
<LineBorder thickness="2,2,2,2">
<LineBorder.borderBrush>
<SystemColor systemColorName="Blue"/>
</LineBorder.borderBrush>
</LineBorder>
</GridPanel.elementBorder>
</GridPanel>
</form.rootContainer>
<form.screenRecords>
<ScreenRecord identifier="FormOnly"/>
</form.screenRecords>
</form>