35 votes
Accepted

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

Here is an attempt to draw a 3D Bloch sphere, on which we can select a point simply clicking on it with the mouse and obtain the corresponding qubit representation. In the code I made use of Szabolcs' ...
user avatar
  • 7,299
18 votes
Accepted

Visually permute rows of a matrix via mouse dragging

EDIT: converted the use of explicit Hold wrappers to appropriate HoldAll and HoldFirst ...
user avatar
  • 7,299
16 votes

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

Perhaps something like this?: DynamicModule[{key = ""}, EventHandler[ Dynamic[key], {"KeyDown" :> (key = CurrentValue["EventKey"])} ]]
user avatar
  • 216k
12 votes
Accepted

How to create Right-Click ActionMenu at mouse position?

Both solutions are undocumented but I don't think they will go away. Menu/MenuItem are used internally for a long time and ...
user avatar
  • 132k
8 votes
Accepted

Why the Mouse dragging response not as smooth as Locator

The reason for this behaviour is that as soon as the cursor gets away from a particular vertex marker it leaves the associated EventHandler. Here's a work-around, ...
user avatar
  • 132k
7 votes

Why the Mouse dragging response not as smooth as Locator

Kuba's answer is brilliant, but it has a rather ugly bit in it with a lot of unnecessary fooling around with Hold and ReleaseHold...
user avatar
  • 106k
7 votes

Docked cell showing keystrokes and mouse buttons actions

Sadly, this can't be done with 100% fidelity. For example, a significant issue is that on some platforms, there is no way to directly capture keystrokes which are mapped to menu commands. The ...
user avatar
  • 12.4k
6 votes
Accepted

Dynamically highlighting elements sharing common properties

...
user avatar
6 votes

Generating EventHandler using Table

Tell me if that's what you are looking for. ...
user avatar
  • 8,417
6 votes
Accepted

Response of Dynamic is slow

The last example in the Classify can be used as a start. lowriniak has translated the code from the cell in the example in the answer here. The example uses logistic regression but the classifier can ...
user avatar
5 votes

Generating EventHandler using Table

TL;DR In order to understand why what you did doesn't work you have to read up on how Mathematica stores information internally (DownValues and ...
user avatar
  • 68.8k
5 votes

Using MousePosition on the entire screen - Screencast with Linux

Just to provide a full answer (and thanks Kuba's answer) in case someone wants to screencast while using Mathematica and byzanz (Gnome only): ...
user avatar
  • 8,417
5 votes
Accepted

Plot with different line style when clicked

Edit: more efficient and more flexible solution: ...
user avatar
  • 132k
5 votes
Accepted

EventHandler and Dynamic

It is not an EventHandler thing.... You can think of Dynamic as a placeholder. Whenever this ...
user avatar
  • 2,506
4 votes
Accepted

Using variable with delay in WhenEvents in NDSolve

you need to declare timeEvent as a DiscreteVariable: ...
user avatar
  • 38.3k
4 votes
Accepted

Using MousePosition on the entire screen - Screencast with Linux

...
user avatar
  • 132k
4 votes
Accepted

How to update plot with EventHandler without using Print

...
user avatar
4 votes
Accepted

Abort an EventHandler?

Shortly, use a SelectorPane and hide EventHandler as soon as the condition is met: ...
user avatar
  • 132k
4 votes
Accepted

How to implement LocatorAutoCreate functionality using EventHandler[]?

Does it fit your needs? ...
user avatar
  • 132k
4 votes
Accepted

Switch bool from False to True on key press?

Using NotebookEventActions with the option PassEventsUp -> True gives the desired behavior in Version 11.3 (Windows 10 - 64 ...
user avatar
  • 349k
3 votes
Accepted

What is "MouseDragged"?

If it were a venn diagram, clicked would be a subset of dragged (at least in the mind of whoever implemented this). You can reproduce what (I think) you want by adding a null event for "clicked": <...
user avatar
  • 9,326
3 votes
Accepted

How to combine manipulate and eventhandler

Here's your code with fixes I've suggested in comments: ...
user avatar
  • 132k
3 votes
Accepted

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

As you mentioned,*EventActions are called before any lower-level stuff, so yes this means you could write your own window-close dialog, but there's another way, ...
user avatar
  • 45.5k
3 votes
Accepted

DynamicModule with Plots and EventHandler

Based on the discussion in chat among Kuba halirutan and Michael Hale: ...
3 votes

Detecting KeyUp events

This has been bugging non stop so I wanted to create a somewhat viable solution for Windows using autohotkey. Run the following as an Administrator in autohotkey on Windows. ...
user avatar
  • 7,409
3 votes

How to get what mouse button was pressed in EventHandler?

Update: A more streamlined version of the original post: ...
user avatar
  • 349k
3 votes

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

Perhaps I am missing some subtlety in your problem description, but it seems to me you are trying make things more complicated than necessary. I don't see why you don't alter the state of your ...
user avatar
  • 106k
3 votes

How to use an event handler inside of a Dialog Notebook

What if you did something like this: ...
user avatar
  • 4,171
3 votes
Accepted

Modifying this GoL implementation to make it sensible to clicks on the corner of the array

Use <= instead of < here: ...
user avatar
  • 29.4k
3 votes

EventHandler not handling my events

It is a mater of keyboard focus. You have to use Dynamic wrappers within your event handler and you must have the visible value of ...
user avatar
  • 106k

Only top scored, non community-wiki answers of a minimum length are eligible