* Button that has different actions
@ 2013-12-25 16:50 Joe Riel
2013-12-25 17:14 ` Drew Adams
0 siblings, 1 reply; 3+ messages in thread
From: Joe Riel @ 2013-12-25 16:50 UTC (permalink / raw)
To: Help GNU Emacs
Can I create a button that has different
actions depending whether it was clicked with
mouse-1 or mouse-2? Or with a modifier key active?
The modifier might not be feasible because Emacs
already binds them with mouse clicks.
--
Joe Riel
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: Button that has different actions
2013-12-25 16:50 Button that has different actions Joe Riel
@ 2013-12-25 17:14 ` Drew Adams
2013-12-26 12:05 ` Michael Heerdegen
0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2013-12-25 17:14 UTC (permalink / raw)
To: Joe Riel, Help GNU Emacs
> Can I create a button that has different
> actions depending whether it was clicked with
> mouse-1 or mouse-2? Or with a modifier key active?
> The modifier might not be feasible because Emacs
> already binds them with mouse clicks.
The answer, unfortunately, is no, not easily/directly.
Such things - allow for multiple actions, popup menu, etc. per
button or tool-bar icon (e.g. via modifier keys) - was requested
long ago, but never got anywhere.
What you can perhaps do as a workaround is to bind a single
command to a button click, and have that command test the event
that lead to the command invocation and then dispatch different
behaviors depending on the event characteristics.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Button that has different actions
2013-12-25 17:14 ` Drew Adams
@ 2013-12-26 12:05 ` Michael Heerdegen
0 siblings, 0 replies; 3+ messages in thread
From: Michael Heerdegen @ 2013-12-26 12:05 UTC (permalink / raw)
To: help-gnu-emacs
Drew Adams <drew.adams@oracle.com> writes:
> What you can perhaps do as a workaround is to bind a single
> command to a button click, and have that command test the event
> that lead to the command invocation and then dispatch different
> behaviors depending on the event characteristics.
Or try with the `keymap' button property.
BTW, you don't need to use the button.el library to create buttons. See
(info "(elisp) Clickable Text")
Regards,
Michael.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-26 12:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-25 16:50 Button that has different actions Joe Riel
2013-12-25 17:14 ` Drew Adams
2013-12-26 12:05 ` Michael Heerdegen
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).