unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Change image upon mouse hover
@ 2023-12-05  5:44 Yuan Fu
  2023-12-05 13:00 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Yuan Fu @ 2023-12-05  5:44 UTC (permalink / raw)
  To: help-gnu-emacs

I have these two images:

I want to change the left one to the right one when mouse hovers over 
it. Is it possible? What's the best way to do it?


Yuan



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Change image upon mouse hover
  2023-12-05  5:44 Change image upon mouse hover Yuan Fu
@ 2023-12-05 13:00 ` Eli Zaretskii
  2023-12-05 21:24   ` Yuan Fu
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2023-12-05 13:00 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Mon, 4 Dec 2023 21:44:13 -0800
> From: Yuan Fu <casouri@gmail.com>
> 
> I have these two images:
> 
> I want to change the left one to the right one when mouse hovers over 
> it. Is it possible? What's the best way to do it?

Did you try to use the help-echo text property?  Its value can be a
function, see "Special Properties" in the ELisp manual.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Change image upon mouse hover
  2023-12-05 13:00 ` Eli Zaretskii
@ 2023-12-05 21:24   ` Yuan Fu
  2023-12-06  3:26     ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Yuan Fu @ 2023-12-05 21:24 UTC (permalink / raw)
  To: help-gnu-emacs



On 12/5/23 5:00 AM, Eli Zaretskii wrote:
>> Date: Mon, 4 Dec 2023 21:44:13 -0800
>> From: Yuan Fu <casouri@gmail.com>
>>
>> I have these two images:
>>
>> I want to change the left one to the right one when mouse hovers over
>> it. Is it possible? What's the best way to do it?
> Did you try to use the help-echo text property?  Its value can be a
> function, see "Special Properties" in the ELisp manual.
>
Thanks, this works brilliantly! However, now I realized that there's 
another problem: I need to change the image back to the one with no 
background when cursor leaves the button.


Yuan



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Change image upon mouse hover
  2023-12-05 21:24   ` Yuan Fu
@ 2023-12-06  3:26     ` Eli Zaretskii
  2023-12-07  1:45       ` Yuan Fu
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2023-12-06  3:26 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Tue, 5 Dec 2023 13:24:29 -0800
> From: Yuan Fu <casouri@gmail.com>
> 
> >> I want to change the left one to the right one when mouse hovers over
> >> it. Is it possible? What's the best way to do it?
> > Did you try to use the help-echo text property?  Its value can be a
> > function, see "Special Properties" in the ELisp manual.
> >
> Thanks, this works brilliantly! However, now I realized that there's 
> another problem: I need to change the image back to the one with no 
> background when cursor leaves the button.

I guess you'd need a timer to do that?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Change image upon mouse hover
  2023-12-06  3:26     ` Eli Zaretskii
@ 2023-12-07  1:45       ` Yuan Fu
  0 siblings, 0 replies; 5+ messages in thread
From: Yuan Fu @ 2023-12-07  1:45 UTC (permalink / raw)
  To: help-gnu-emacs



On 12/5/23 7:26 PM, Eli Zaretskii wrote:
>> Date: Tue, 5 Dec 2023 13:24:29 -0800
>> From: Yuan Fu <casouri@gmail.com>
>>
>>>> I want to change the left one to the right one when mouse hovers over
>>>> it. Is it possible? What's the best way to do it?
>>> Did you try to use the help-echo text property?  Its value can be a
>>> function, see "Special Properties" in the ELisp manual.
>>>
>> Thanks, this works brilliantly! However, now I realized that there's
>> another problem: I need to change the image back to the one with no
>> background when cursor leaves the button.
> I guess you'd need a timer to do that?
>
Why didn't I think of that? Yes, that works great! Thanks! I was trying 
crazy hacks on track-mouse and read-events and had no luck ;-)

Yuan



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-07  1:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-05  5:44 Change image upon mouse hover Yuan Fu
2023-12-05 13:00 ` Eli Zaretskii
2023-12-05 21:24   ` Yuan Fu
2023-12-06  3:26     ` Eli Zaretskii
2023-12-07  1:45       ` Yuan Fu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).