Example 1: Simple input

The module "comment.4gl":
PUBLIC TYPE cb_comment_event FUNCTION (event STRING)
PRIVATE DEFINE cb_ce cb_comment_event

PRIVATE DEFINE the_comment VARCHAR(200)

PUBLIC FUNCTION set_event_callback(f cb_comment_event)
    LET cb_ce = f
END FUNCTION

PUBLIC FUNCTION set_event_callback_2(f FUNCTION (event STRING))
    LET cb_ce = f
END FUNCTION

PUBLIC FUNCTION set_comment(s STRING)
    LET the_comment = s
END FUNCTION
    
PUBLIC FUNCTION get_comment()
    RETURN the_comment
END FUNCTION

DIALOG comment_input()
    INPUT BY NAME the_comment ATTRIBUTES(WITHOUT DEFAULTS)
        ON ACTION add_sep ATTRIBUTES(TEXT="Add sep")
           LET the_comment = the_comment || "\n---\n"
           CALL fgl_dialog_setcursor(LENGTH(the_comment)+1)
           IF cb_ce IS NOT NULL THEN
              CALL cb_ce("comment_changed")
           END IF 
        ON ACTION clr_cmt ATTRIBUTES(TEXT="Clear")
           LET the_comment = NULL
           IF cb_ce IS NOT NULL THEN
              CALL cb_ce("comment_changed")
           END IF
    END INPUT
END DIALOG

For the complete example, see Example 3: DIALOG with SUBDIALOG.