LWW toggling push-button
Does anyone know how to make a push-button that toggles (stays pushed in until you click it again)? Windows-specific solution OK.
I don't see any capi option that this does this. When I try to reach around capi and make direct Windows calls (SendMessage BM_SETSTATUS), but this seems to generate an extra callback (when the button is set) when the button loses focus, as in the code below...
I have the code that does this manually, by sub-classing button and manually changing the image, but, creating 30 or so button images (x 2) is killing me. It would be simpler if I could tell a standard capi button to stay pushed in. I'm hoping that I've missed something obvious :-).
tia
pt
(defparameter *button* nil)
(defun tbutton ()
(setq *button*
(capi:contain
(make-instance
'push-button
:text "Press Me"
:data '(:some :data)
:callback #'(lambda (data interface)
(capi:display-message
"Pressed ~S ~S"
data
(get-state *button*)))))))
(defun set-button ()
(win32:send-message
(slot-value
(slot-value *button* 'capi-internals:representation)
'win32::hwnd)
#x00f3 1 0))
(defun clear-button ()
(win32:send-message
(slot-value
(slot-value *button* 'capi-internals:representation)
'win32::hwnd)
#x00f3 0 0))
(defun get-state (button)
(win32:send-message
(slot-value
(slot-value button 'capi-internals:representation)
'win32::hwnd)
#x00f2
0
0))
(defun sel-button ()
(capi:apply-in-pane-process *button* #'(setf capi:button-selected) t *button*))
(defun unsel-button ()
(capi:apply-in-pane-process *button* #'(setf capi:button-selected) nil *button*))