Example 3: DIALOG with SUBDIALOG

Form file "comment.per":
LAYOUT
GRID
{
[cmt                              ]
}
END
END
ATTRIBUTES
TEXTEDIT cmd = FORMONLY.the_comment, STRETCH=BOTH;
END
The module "comment.4gl":
DEFINE the_comment VARCHAR(200)

DIALOG comment_input()
    INPUT BY NAME the_comment
        ON ACTION add_sep
           LET the_comment = the_comment || "\n---"
    END INPUT
END DIALOG
Form file "form1.per":
LAYOUT
VBOX
GRID
{
Id:   [f1        ]
Name: [f2                                        ]
}
END
FORM "comment"
END
END
ATTRIBUTES
EDIT f1 = FORMONLY.cust_id TYPE INTEGER;
EDIT f2 = FORMONLY.cust_name TYPE VARCHAR;
END
Program file:
IMPORT FGL comment

MAIN
  DEFINE cust RECORD
            cust_id INTEGER,
            cust_name VARCHAR(50)
          END RECORD

  OPTIONS INPUT WRAP 

  OPEN FORM f1 FROM "form1"
  DISPLAY FORM f1

  DIALOG ATTRIBUTES(FIELD ORDER FORM, UNBUFFERED)

     INPUT BY NAME cust.*
        ON ACTION check_exists
           MESSAGE "Check if customer record exists"
     END INPUT

     SUBDIALOG comment_input

     ON ACTION close 
        EXIT DIALOG

  END DIALOG

END MAIN