gs:check-event adujstment for user defined exit.

Guiserver, GTK-server, OpenGL, PostScript,
HTML 5, MIDI, IDE
Locked
newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

gs:check-event adujstment for user defined exit.

Post by 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
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

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:

Code: Select all

#!/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
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

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

Locked