formMain.vrf.annotated

#

Declare constants to determine which combobox item was selected.

DclConst NONMODAL Value(0)
DclConst MODAL_EXFMT Value(1)
DclConst MODAL_CALL Value(2)
#

Populate the combobox.

comboboxFormSelection.AddItem("Show")
comboboxFormSelection.AddItem("ExFmt")
comboboxFormSelection.AddItem("Call")
#

Set its default, zero-based position.

comboboxFormSelection.ListIndex = 0
#

Declare a field for the ExFmt's parameter list.

DclFld CustomerName Type(*Char) Len(40)
#

Handling the button click to display a form.

BEGSR buttonDisplay Click
    Select
#

Use Show to display a form.

        When comboboxFormSelection.ListIndex = NONMODAL
#

Assign the textbox's value to a global variable.

            Global_CustomerName = textboxCustomerName.Text 
            Show formNonModalShow
#

This code does not change the textbox in this form because this form's code execution does not pause after having done the Show opcode. This line of codex does get executed, but it does so immediately after performing the Show opcode; so the name assigned to the textbox is the exact save as the name assigned to the global variable just before the Show as performed.

            textboxCustomerName.Text = Global_CustomerName
#

Uncomment this MsgBox to help understand program flow with the Show opcode.
MsgBox 'This displayed immediately after the form'

#

Use ExFmt to display a form.

        When comboboxFormSelection.ListIndex = MODAL_EXFMT
#

Assign the textbox's value to a global variable.

            Global_CustomerName = textboxCustomerName.Text 
            ExFmt formModalExFmt
#

This code changes the textbox in this form because this form's code execution paused after having done the ExFmt opcode.

            textboxCustomerName.Text = Global_CustomerName
#

Uncomment this MsgBox to help understand program flow with the ExFmt opcode.
MsgBox 'This displayed when the form closed or hidden'

#

Use Call to display a form.

        When comboboxFormSelection.ListIndex = MODAL_CALL
#

Assign the textbox's value to field used in the parameter list.

            CustomerName = textboxCustomerName.Text 
            Call formModalCall
            DclParm CustomerName
#

Change this form's textbox upon returning.

            textboxCustomerName.Text = CustomerName
 Endsl  

ENDSR