

In this task, the goal is to input a string and the integer 75000, from graphical user interface.



See also: User input/Text

OPTION GUI TRUE
PRAGMA GUI gtk3
 
DECLARE text TYPE STRING
DECLARE data TYPE FLOATING
 
gui = GUIDEFINE(" \
    { type=WINDOW name=window callback=delete-event title=\"Rosetta Code\" width-request=300 } \
    { type=BOX name=box parent=window orientation=GTK_ORIENTATION_VERTICAL } \
    { type=ENTRY name=entry parent=box margin=4 callback=activate } \
    { type=SPIN_BUTTON name=spin parent=box margin=4 numeric=TRUE } \
    { type=BUTTON_BOX name=bbox parent=box } \
    { type=BUTTON name=button parent=bbox margin=4 callback=clicked label=\"Exit\" }")
 
CALL GUISET(gui, "spin", "adjustment", gtk_adjustment_new(75000, 0, 100000, 1, 1, 0))
 
REPEAT
    event$ = GUIEVENT$(gui)
UNTIL event$ = "button" OR event$ = "window"
 
CALL GUIGET(gui, "entry", "text", &text)
PRINT text FORMAT "Entered: %s\n"
 
CALL GUIGET(gui, "spin", "value", &data)
PRINT data FORMAT "Entered: %g\n"