Questions tagged [eventhandler]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
162
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
744 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. ...
18
votes
1answer
2k 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 ...
12
votes
1answer
327 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-...
11
votes
1answer
148 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 ...
10
votes
1answer
410 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
252 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
2answers
384 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
156 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 ...
8
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 ...
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
289 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
270 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
331 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
130 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
161 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
435 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, ...
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
190 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
211 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
273 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
75 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
499 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
54 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
116 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
308 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
188 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
666 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
252 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
120 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
119 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
225 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
1answer
84 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
111 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
142 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
82 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
265 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
282 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
89 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
391 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
197 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 ...
3
votes
0answers
30 views

How can I disable built in selection action for mouse click events? [duplicate]

I am trying to improve a demonstration that I previously submitted to the Wolfram Demonstration site. That demonstration enables a user to select a position on an Earth globe and see the latitude and ...
3
votes
0answers
40 views

Is it possible to prevent LocatorPane from modifying locator positions unless Alt ket is down?

I am using the LocatorAutoCreate option which allows the user to hold Alt while clicking in order to create/remove locators. However, I need to be able to prevent ...
3
votes
0answers
45 views

EventHandler click event in Graphics[ ] object does not work properly after using Deploy [duplicate]

There is a problem clicking layered Graphics objects after using Deploy. For example, the code below works as intended with the Disk 'on top of' the Line. Click either object anywhere and EventHandler ...
2
votes
3answers
504 views

Changing the Actions in EventHandler

I would like to be able to change which action specified events take depending on some condition. For example, I have established a SetterBar ...
2
votes
1answer
384 views

Dynamically updating interactive objects in Mathematica

Is it possible to create interactive code in Mathematica (via EventHandler[] or Manipulate[] perhaps) that continually updates some calculation based on external data in the time when no user input is ...
2
votes
1answer
227 views

Change the behaviour of a LocatorPane

Normally, LocatorPane detects any single click as in the following example: ...
2
votes
1answer
296 views

DynamicModule with Plots and EventHandler

I am making a little animation in Mathematica, along the lines of some of the Wolfram demo projects. I'd like to animate a simulated trajectory of a random process (say a Poisson process), and while ...