Questions tagged [eventhandler]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
164
votes
1answer
29k views

Mathematica Minecraft

Some time ago I asked myself: with all these great graphics and interactive capabilities of Mathematica, what kinds of 3D games can be implemented in it? And the answer which came to mind is ...
27
votes
4answers
2k views

Detecting KeyUp events

Is there a way to detect when a key is released, similar to EventHandler[InputField[], {"KeyDown", "k"} :> Print["k pressed"]] It seems such detection isn't ...
25
votes
1answer
758 views

How to improve these WASD + mouse look 3D controls?

Insipred by this question and the corresponding answer I've written a code for full-screen exploration of 3D scenes using standard WASD and mouse look controls. Here it is. ...
20
votes
1answer
3k views

How to draw an interactive, mouse clickable, 3D Bloch sphere?

A 3D Bloch (Poincaré) sphere is nicely shown in this wolfram demonstration. However, in that example, it is not possible to mouse select a point on the sphere and directly get the corresponding qubit ...
13
votes
1answer
180 views

Visually permute rows of a matrix via mouse dragging

I'm looking for a way to permute the rows of a matrix visually via mouse dragging, for example by clicking and dragging on a row in the MatrixPlot corresponding to the matrix. What would be the best ...
12
votes
1answer
389 views

How to create Right-Click ActionMenu at mouse position?

I have a Grid and need to enable some actions on individual values. For this I want to use an ActionMenu that shows on right-...
10
votes
1answer
421 views

EventHandler not working within DateListPlot (?)

I have some {date, value} data: data = Transpose[{AbsoluteTime /@ Thread[{2012, Range[12], 15}], RandomInteger[10, 12]}] ...
10
votes
1answer
269 views

Detect when InputField gets keyboard focus

How might I detect when an InputField comes into focus? For example ideally something like this would work. ...
9
votes
3answers
2k views

Hovering mouse cursor over a plot to display a “corresponding” point in another plot

I'm trying to reproduce a variant of this view, where hovering the mouse over a point highlights its "corresponding" point on all plots: In my case, the additional complexion is that the x-axes are ...
9
votes
2answers
386 views

Throttle the response to keystrokes in an EventHandler expression

What might be the most elegant way to throttle the a,s functions triggered by an EventHandler...
8
votes
1answer
179 views

Docked cell showing keystrokes and mouse buttons actions

When I send bug reports to WRI, sometimes I attach a screen video record, like on the following example (that I just sent as an improvement suggestion). As you can see, I use OSD Hotkey, to make sure ...
7
votes
1answer
1k views

How can I get 'KeyDown' without writing 26 commands?

EventHandler and {"KeyDown","x"} work for registering a specific letter. Is there a direct way to return whichever letter keys ...
7
votes
2answers
327 views

Why the Mouse dragging response not as smooth as Locator

I am experimenting to use MouseDragged eventhandler to change the vertices positions of a triangle, it works, but not as smooth as using Locators. Is this the ...
7
votes
1answer
283 views

Detect a graphic primitive inside a Graphic

Please excuse me if that question is too basic but I couldn't find anything in the documentation or on here. If you consider the following Graphic I would like to ...
7
votes
1answer
358 views

What is “MouseDragged”?

Bug introduced in V10.1 or earlier and persisting through V11.3 Print is triggered just by pressing the mouse button. ...
6
votes
2answers
142 views

Abort an EventHandler?

How do I stop an EventHandler? I'm trying to allow the user unlimited inputs on the arrow keys UNTIL certain conditions are met, and then stop the ...
6
votes
1answer
167 views

How to handle keyboard events for unselected item in CDF?

How can I force the keyboard input to work for this cell without clicking on it after I evaluate or showing a blinking selection cursor? This is for running CDF games in a browser. ...
6
votes
1answer
449 views

Different actions with dragging and clicking points in same graphic

On a graphic (in this example a simple plot), I need two points to move when I drag with the mouse, and these points must move to location {1,1} when I click on them. This is how I got it to work, ...
6
votes
0answers
54 views

How to create a conditional EventHandler

Summary Can we make something like the following work as an action for EventHandler? ...
5
votes
2answers
1k views

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 ...
5
votes
2answers
198 views

Generating EventHandler using Table

I would like to change the edge color of a graph when double clicking on it, the following code works: ...
5
votes
2answers
219 views

Capturing an F1

I teach an Intro to Mathematica course, and one of the things I try to reinforce early on is just how helpful Mathematica's help is. In the very first lab for the course, I even give the students a ...
5
votes
1answer
361 views

Response of Dynamic is slow

I wrote the following code to make an interactive GUI for Mathematica's Neural Network example of Digit Classification Here is the Code ...
5
votes
1answer
79 views

Dynamically highlighting elements sharing common properties

I want to make a table of elements such that when the cursor is over a target element, all other elements of the table sharing some specified common property with the target are highlighted (let's say ...
5
votes
1answer
521 views

Evaluation order control

This question is related to Evaluation order of Button's action Concusion was, Button[]'s actions are evaluated in preemptive link so "the code that needs to ...
5
votes
1answer
66 views

How to implement LocatorAutoCreate functionality using EventHandler[]?

The documentation for LocatorPane says that LocatorPane is a special case of EventHandler, and gives the following code: ...
5
votes
1answer
127 views

Triggering events based on choices made inside of system dialogs (e.g. window close)

I'm trying to arrange for Mathematica to perform a certain action every time a notebook is saved or closed (with or without saving). The obvious way to do this would be through event handling. So, ...
4
votes
2answers
327 views

EventHandler and Refresh rate

Based on the example of the Documentation of MousePosition, Properties and Relations, here is my test code using "MouseDragged" instead of "MouseClicked": ...
4
votes
2answers
192 views

Using MousePosition on the entire screen - Screencast with Linux

In order to record animations more easily while using Mathematica on Linux, I would need to know how to get the position of three clicks. The following picture (main part generated by ...
4
votes
4answers
757 views

EventHandler Not Detecting KeyDown

I am trying to use EventHandler to detect KeyDown within a LocatorPane. Anytime I press a key inside the LocatorPane the proper action is not executed (doesn't matter which key I choose) but rather ...
4
votes
1answer
261 views

In a DynamicModule, is it possible to use multiple EventHandler declarations? [duplicate]

Possible Duplicate: Wrapping EventHandler by Table I am running Mathematica 7. However, I am new to using Dynamic, ...
4
votes
1answer
114 views

Switch bool from False to True on key press?

I would like to let a boolean variable switch when I press a key on the keyboard. For example, I write ...
4
votes
1answer
138 views

How to use an event handler inside of a Dialog Notebook

I am designing a tank game in Mathematica for my class and currently I have a tank that can drive along a curve and shoot a point at a set angle, but I want to get all of this into some sort of pup up ...
4
votes
1answer
146 views

How to get what mouse button was pressed in EventHandler?

I'm trying to make an interface that (basically) records what mouse button was pressed inside the cell of a matrix. The code I have so far is ...
4
votes
1answer
53 views

Does MousePosition[“Graphics”] give coordinates in outermost Graphics?

It seems that this issue has been raised a few times, but what exactly does MousePosition["Graphics"] answer? This code ...
4
votes
1answer
137 views

Modify Dynamic value within EventHandler

I'm trying to build a tic tac toe program using a 3x3 board list running inside of a DynamicModule with a separate window displaying the current value and accepting ...
4
votes
0answers
40 views

How to control global key event handling for all front end sessions?

This website collects many methods for implementing user defined keyboard shortcuts through KeyEvent items in KeyEventTranslations.tr, see 16697, 16165, 23285, 2572, etc. Some of these were collected ...
4
votes
0answers
229 views

Is it possible to model the piano key attack?

My purpose is to model the attack of a piano key. As the key is pressed a sound must be emitted. When the key is released the sound must stop with decreasing volume. I have a partial success when ...
3
votes
3answers
77 views

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 ...
3
votes
1answer
118 views

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 ...
3
votes
2answers
138 views

Plot with different line style when clicked

I have a plots with many lines and would like to be able to highlight lines when clicked (or on mouseover). When the data plotted is small this works well ...
3
votes
2answers
162 views

How can I draw a variable number of dynamic, interactive objects, preserving their internal states?

Consider the following toy example: I have a "dynamical, interactive" graphics primitive like the following: ...
3
votes
2answers
90 views

How to get highlighted text from event

I want to do the following: Given a text in a Mathematica dynamic module "at runtime". If some text is selected with the cursor/mouse, after the mouse button release, get the selected text. Thank ...
3
votes
2answers
151 views

Circumnavigate a curve (part 2)

I got help from Kuba on a previous post regarding this issue I'm having but after integrating that solution into my code, the problem changed and I am left with something I don't know much about (even ...
3
votes
1answer
272 views

Creating event handler with ImplementJavaInterface inside a package

I am trying to make my Mathematica function to serve as an event handler for the events generated by a Java object. Specifically, I have a Java object that connects as a client to a server that ...
3
votes
1answer
301 views

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 ...
3
votes
1answer
94 views

How to mimic CheckboxBar's Method->“Active” option in a Manipulate's checkbox control?

CheckboxBar has a Method -> "Active" option that allows you to click the label to change the state of a checkbox. I would ...
3
votes
1answer
67 views

Nested front-end-only EventHandler

Bug introduced in 11.3 or earlier, and persisting through 12.0 CASE:4372001 confirmed I am running into an issue trying to improve the performance of my user interface by moving as much of the ...
3
votes
1answer
441 views

How to Use Mouse Events & EventHandler in Demonstrations

One of the primary criteria for an acceptable Demonstration is, of course, that multiple copies of the Manipulate Output Cells [MOCs] have to have independent controls and datasets: the operation of ...
3
votes
1answer
202 views

How can I improve my Zooming code?

I recently started to work with the EventHandler function to make it possible to Zoom, Pan, etc, with only the use of a mouse. I have found a way to zoom that is ...