Questions tagged [eventhandler]
107 questions
5
votes
2 answers
Detecting changes of variables' values
Is it possible to detect (and create a trigger for) an event when any of the variables defined in the notebook changes its value (for any reason)?
I need to know which variable got changed and what the new value is.
Here are some details:
I have a…
verse
- 1,287
- 6
- 18
4
votes
3 answers
EventHandler not handling my events
I seem to be able to use EventHandler to handle mouse events, but not keyboard events. Here is a working example with MouseClicked -- it makes the picture smaller every time the right mouse button is clicked. For the example, the t variable is a…
bill s
- 68,936
- 4
- 101
- 191
3
votes
0 answers
How to Get Mathematica to Recognize a Three-Finger Trackpad Click?
The following code allows me to change the size of a disk back and forth with a one-finger trackpad click, and change the color of a disk back and forth with a two-finger trackpad click.
DynamicModule[{col = Green, size = 1},
EventHandler[
…
B flat
- 5,523
- 2
- 14
- 36
3
votes
1 answer
EventHandler and Dynamic
I just found a behaviour of an EventHandler that I cannot explain. Here is a highly simplified version. I will present two simple EventHandlers. The first one shows the behaviour that I would have expected from the second one as…
Fred Simons
- 10,181
- 18
- 49
3
votes
1 answer
Problem with dynamic MouseAppearance updating while "MouseDown"
my problem is with combining EventHandler and MouseAppearance. I want to change cursor appearance if I have primary button pressed over on item. But only then, after releasing it should be "Arrow" back.
I thought it should…
Kuba
- 136,707
- 13
- 279
- 740
2
votes
2 answers
Make curve disappear gradually after Mouse Up
I am trying to emulate a feature on GoodNotes that allows me to draw a glowing curve on a graphic and the moment I let go of the mouse, the curve gradually disappears. See gif below. The gif is a little jumpy because of the limited frames. The…
B flat
- 5,523
- 2
- 14
- 36
1
vote
0 answers
Strange behavior of my vertex eventhandler!
I have two level EventHandler. The inner one is made of vertex of Graph and the other outer one is of the Dynamic Graph.
(1) If I select a arbitray place on the Graph except a vertex, then every thing is OK, but
(2) if I select the vertex after…
Junho Lee
- 5,155
- 1
- 15
- 33
1
vote
1 answer
How to put an on-click event into a new notebook opened with NotebookPut?
This prints "This is the question", and then when you click on it it prints "This is the answer":
EventHandler["This is the question",
{"MouseClicked" :> Print["This is the answer"]}]
This opens a new notebook in which it prints "This is the…
tell
- 320
- 1
- 8
1
vote
1 answer
Multiple calls to SetOptions with NotebookEventActions: How to retain earlier custom event handlers?
I have a module defining handlers of KeyDown events that I reuse in various notebooks. In some cases I need to define separate handlers for additional keys. Unfortunately, later calls to SetOptions[...] seem to undo earlier ones. For example, I…
volk
- 65
- 4
0
votes
0 answers
What is the current notebook save event for the `EventHandler`?
Suppose I have an action like follows:
ClearAll[eventAction];
eventAction[]:=Module[{
$previousPath,
$todaysPath
},
$previousPath=NotebookFileName[EvaluationNotebook[]];
$todaysPath=FileNameJoin[{
NotebookDirectory[],
…
user13892
- 9,375
- 1
- 13
- 41
-2
votes
2 answers
EventHandler and ActionMenu
Here is the bit of code causing me issues:
{DynamicModule[{nothing},
EventHandler[
ActionMenu["Set x", {"x = 1" :> (x = 1;)}, Enabled -> True],
{"MouseClicked" :> (nothing++)}]], Dynamic[x]}
No matter how hard I try to click the ActionMenu…
Öskå
- 8,587
- 4
- 30
- 49