Lisp HUG Maillist Archive

clickable static text?

I'm trying to make some hyperlinks with CAPI. Ideally, just some lines 
of blue underlined text that respond to a mouse click event. Maybe that 
change color when the mouse is over.  I need this for Mac and Windows.

But this simple task is proving to be very difficult.

At first I tried using the button class, but it always had the button 
frame around it on the Mac.  Next I tried making a custom class that 
inherited from   titled-object and item, but  action-callback seems to 
never be called and none of the standard button handlers work.    
Lastly, I am drawing a string into an output pane, but on Windows the 
output pane has gruesome borders around it. 

While I wait for a reply I'll look at trying to figure out how to remove 
the borders from my output-pane, but this seems like it should be really 
simple. Am I overlooking a preprovided CAPI class for doing something 
like this?  Is there a simpler way to make static text respond to the mouse?

Thanks,

Chris

(defclass text-hyperlink   (output-pane)    ((text :initarg :text 
:accessor text))
                           (:default-initargs  :display-callback #'draw-text
                                               :input-model 
'(((:button-1 :release) text-hyperlink-click))
                                               :min-height 20))


(defun draw-text (pane x y width height)
  (declare (ignore width height))
  (gp:draw-string pane (text pane) (+ 10 x) (+ 10 y) :foreground :blue))
 

(defun text-hyperlink-click (pane &rest args)
  (declare (ignore args))
  (debug-msg "click:~S  ~S" pane (text pane)))


Re: clickable static text?

Unable to parse email body. Email id is 9280

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