#!/usr/bin/newlisp # # Demo with XForms. NewLisp can access this library directly and create a GUI with it. # # Docs for the API are here: http://www.bbso.njit.edu/Documentations/xforms/forms.html # # August 18, 2006 - PvE. #--------------------------------------------------------------------------------------- (load "xf.lsp") (define (main argc argv) # Initiliaze XForms first (XF:fl_initialize (address argc) (address argv) "XForms" 0 0) # Create a window and a container (setq WINDOW (XF:fl_bgn_form XF:FL_UP_BOX 300 240)) (XF:fl_add_box XF:FL_NO_BOX 160 40 0 0 "Current time") # Add the clock (setq clock (XF:fl_add_clock XF:FL_ANALOG_CLOCK 10 10 280 180 "Analog clock")) # Create the buttons, set some colors (setq ABOUT (XF:fl_add_button XF:FL_NORMAL_BUTTON 10 200 80 30 "About")) (setq BUTTON (XF:fl_add_button XF:FL_NORMAL_BUTTON 210 200 80 30 "Exit")) (XF:fl_set_object_color BUTTON XF:FL_GREEN XF:FL_RED) # End definition, show main window (XF:fl_end_form) (XF:fl_show_form WINDOW 1 1 "Showing the current time") (set 'event 0) # Main loop is here (while (and (!= event "") (!= event BUTTON)) # Get result from 'do_forms' (set 'event (XF:fl_do_forms)) # Has the 'ABOUT' button been pressed? (if (= event ABOUT) (XF:fl_show_message "Demo with XForms\n" "Created with newLisp by Peter van Eerten." "")) ) ) # Call main GUI routine (main 1 (pack "ld" (address "demo.lsp") )) (exit)