IDENTIFICATION DIVISION. PROGRAM-ID. ex2. AUTHOR. Rildo Pragana. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 TSCR PIC X(512). 77 TRES PIC X(80). 77 EOSTR pic X value LOW-VALUES. 77 WKEY pic X. 77 w-num pic 9(5)v99. PROCEDURE DIVISION. CALL "initTcl" * source (load) our script into the tcl interpreter string "source ex2.tcl" EOSTR into TSCR call "stcleval" using TSCR TRES. * populate our listbox with some lines string "lappend list_inputs one two three" EOSTR into TSCR call "stcleval" using TSCR TRES. 10-Loop. * make it stay with control till the variable "ok" is modified string "tkwait variable ok" EOSTR into TSCR call "stcleval" using TSCR TRES. * make the window unmapped (invisible) and grab the result we want string "wm withdraw . ; set entry_data" EOSTR into TSCR call "stcleval" using TSCR TRES. if TRES = SPACES go to 90-Finish. display "Input from entry:" at 0501 display TRES at 0519 * append our input to the listbox too string "lappend list_inputs [string trim {" TRES "}] ; .lst yview end" EOSTR into TSCR call "stcleval" using TSCR TRES. * read a number from the terminal (not the GUI!) display "Entre um número:" at 0101 accept w-num at 0118 * show again the dialog (window) and wait for the user to finishi input string "wm deiconify . ;" "set entry_data {} ;" "focus .e ; update idletasks" EOSTR into TSCR call "stcleval" using TSCR TRES. go to 10-Loop. 90-Finish. * get a key from the console and exit display "Press a key to exit..." at 0801 accept wkey STOP RUN.