gs:check-event adujstment for user defined exit.

Started by newdep, November 12, 2007, 07:19:54 AM

Previous topic - Next topic

newdep

Hi Lutz,



A current problem with the gs:check-event is that it will (exit) when the user

presses the 'EXIT button on the Window or if the event is 'NIL.



Actualy what you want is an exit of the guiserver but NOT from the newlisp script.



Currently open files and running processes/forks cant be catched

when the user closed the window.



I tried to adjust this in guiserver.lsp but the guiserver.jar keeps hanging now ;-)



Norman.
-- (define? (Cornflakes))

Lutz

#1
You could use gs:window-closed to fire an event in newLISP. This event handler than could shut down in an orderly fashion and then simply exit, which then will let the guiserver shut down too:


#!/usr/bin/newlisp
; close-demo.lsp - demonstrate window-closed event

(load (append (env "NEWLISPDIR") "/guiserver.lsp"))

(gs:init)

(gs:frame 'CloseDemo 100 100 400 300 "Close window demo")
(gs:window-closed 'CloseDemo 'closing-action)
(gs:set-resizable 'CloseDemo nil)
(gs:set-visible 'CloseDemo true)

(define (closing-action)
(println (args))
(println "Cleaning up")
(sleep 2000)
(exit)
)

(gs:listen)
;; eof


Lutz

newdep

#2
Thanks  window-closed  did the trick ! ;-)
-- (define? (Cornflakes))