Lisp HUG Maillist Archive

Exiting a display pane

I'm displaying a remote control panel using this code: 
 
 (setf *RCPanel* (make-instance 'remote-control-panel
                      :window-styles '(:always-on-top
                                       :hides-on-deactivate)
                      :x 200
                      :y 100
                      :title "Remote Control Panel"))
 
  (capi:display *RCPanel*)
My question is, if the user closes the display by clicking on the red x at the upper right of the display window, is there a way to force this line of code to be executed as the display window is closing:
 
(mp:process-kill *sensor-thread*)
 
Or alternatively is there a way to suppress the display of the red x - I have an "Exit" button in the display pane I'd prefer them to use and it does kill the thread on exiting.
 
As always, thank you for your help!
 
Bruce.
 

Re: Exiting a display pane

On Sun, 19 Mar 2006 11:02:04 -0800, "Bruce J. Weimer, MD" <bjweimer@charter.net> wrote:

> I'm displaying a remote control panel using this code: 
>
>  (setf *RCPanel* (make-instance 'remote-control-panel
>                       :window-styles '(:always-on-top
>                                        :hides-on-deactivate)
>                       :x 200
>                       :y 100
>                       :title "Remote Control Panel"))
>
>   (capi:display *RCPanel*)
>
> My question is, if the user closes the display by clicking on the
> red x at the upper right of the display window, is there a way to
> force this line of code to be executed as the display window is
> closing:
>
> (mp:process-kill *sensor-thread*)

I don't know what a remote control panel is, but assuming it is a
normal CAPI interface how about :DESTROY-CALLBACK?  Isn't that what
you want?

> Or alternatively is there a way to suppress the display of the red x
> - I have an "Exit" button in the display pane I'd prefer them to use
> and it does kill the thread on exiting.

I've used this (only on Windows):

  (defun no-close-box (interface)
    "Makes sure the close box of the CAPI interface INTERFACE isn't
  active.  To be called from the interface's create callback."
    (let* ((hwnd (capi:simple-pane-handle interface))
           (menu (win32:get-system-menu hwnd nil)))
      (win32:enable-menu-item menu win32:sc_close win32:mf_grayed)))

  (capi:display (make-instance 'capi:interface
                               :create-callback #'no-close-box))

HTH,
Edi.


Updated at: 2020-12-10 08:48 UTC