From: Wai-Kwong Sam LEE

Subject: Re: [pcspr4288] Custom event handling of a widget

Date: 1997-1-3 21:01

On Tue, 31 Dec 1996, Ken Cheetham wrote:
> Since the EVENT method is called on the dialog-item-window of a > "Windows subclassed" widget, you could intercept all left-clicks on > the my-item-list subclass defined above like this: > > (defmethod event ((window my-item-list-pane)(message (eql mouse-left-down)) > buttons data time) > (format t "You clicked on ~a at position ~a,~a~%" > (object-name (window-dialog-item window)) > (position-x data)(position-y data)) > > ;; This call-next-method passes the event back to the control's own > ;; event handler built into the OS so that it will select the > ;; clicked list item as usual. Removing this line would prevent > ;; the OS from selecting the clicked item. > (call-next-method)) > > (subclass-widget a-my-item-list-instance)
1. I have tried something similar to above without the line expression (subclass-widget a-my-item-list-instance) and it works. I'm just wondering if the (subclass-widget instance) expression really does anything. 2. It seems that this method is too low-level in my case. What I'd like to do is to let the user use a mouse to select an item and I'd process the item with my function. The behavior is almost exactly the same as set-value-fn but I'd like the function to be invoked even if the user clicks on the same item repeatedly. However, the above suggested method intercept the call before the new item is selected so my function works on the old item. I have tried to make the method as an after method but it does the same thing. Is there anyway to get around? Say, programatically send a system message to force the system handler to process the event, or progrmatically produce an event. Thanks a lot for the help. - sam