#!basic 10 REM ******************************************************** 11 REM 12 REM Testing MOLE basic with GTK-server 13 REM February 13, 2006 - PvE. 14 REM 15 REM ******************************************************** 20 SYSTEM("gtk-server -fifo=/tmp/demo.bas -detach") 40 gtk$ = "gtk_init NULL NULL":GOSUB 500 50 gtk$ = "gtk_window_new 0":GOSUB 500 55 win$ = result$ 60 gtk$ = "gtk_widget_set_usize " + win$ + " 300 100":GOSUB 500 70 gtk$ = "gtk_window_set_title " + win$ + " " + CHR$(34) + "MOLE Basic with GTK" + CHR$(34):GOSUB 500 80 gtk$ = "gtk_window_set_position " + win$ + " 1":GOSUB 500 90 gtk$ = "gtk_table_new 20 20 1":GOSUB 500 95 tbl$ = result$ 100 gtk$ = "gtk_container_add " + win$ + " " + tbl$:GOSUB 500 110 gtk$ = "gtk_button_new_with_label Quit":GOSUB 500 115 but$ = result$ 120 gtk$ = "gtk_table_attach_defaults " + tbl$ + " " + but$ + " 12 19 12 19":GOSUB 500 130 gtk$ = "gtk_label_new " + CHR$(34) + "MOLE can use GTK!!" + CHR$(34):GOSUB 500 135 lab$ = result$ 140 gtk$ = "gtk_table_attach_defaults " + tbl$ + " " + lab$ + " 1 15 1 10":GOSUB 500 150 gtk$ = "gtk_widget_show_all " + win$:GOSUB 500 160 REM -- Mainloop 170 DO 180 gtk$ = "gtk_server_callback wait":GOSUB 500 190 UNTIL result$ = win$ OR result$ = but$ 490 gtk$ = "gtk_server_exit":GOSUB 500 499 END 500 REM ********************************************** Communication function 510 OPEN "/tmp/demo.bas" FOR OUTPUT AS #1 520 PRINT #1 gtk$ 530 CLOSE #1 540 OPEN "/tmp/demo.bas" FOR INPUT AS #1 550 INPUT #1 result$ 560 CLOSE #1 570 RETURN