39 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 by simply clicking on it with the mouse and obtaining the corresponding qubit representation. In the code I made use of ...
glS's user avatar
  • 7,623
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 ...
glS's user avatar
  • 7,623
15 votes

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

Perhaps something like this?: DynamicModule[{key = ""}, EventHandler[ Dynamic[key], {"KeyDown" :> (key = CurrentValue["EventKey"])} ]]
Michael E2's user avatar
  • 236k
13 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 ...
Kuba's user avatar
  • 137k
11 votes
Accepted

Using graphics primitives as buttons

It might be easier to build your own button using EventHandler and CurrentValue: ...
Lukas Lang's user avatar
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 ...
xslittlegrass's user avatar
5 votes
Accepted

Plot with different line style when clicked

Edit: more efficient and more flexible solution: ...
Kuba's user avatar
  • 137k
5 votes
Accepted

EventHandler and Dynamic

It is not an EventHandler thing.... You can think of Dynamic as a placeholder. Whenever this ...
ihojnicki's user avatar
  • 3,051
5 votes

Context menu to graphics component

This is likely cheating. It simulates a context menu with a palette. But there are no menus shown outside the disks and it works in a Deployed cell. Note that the ...
Jean-Pierre's user avatar
  • 5,187
5 votes

Context menu to graphics component

It is not perfect but maybe it fits your needs: ...
Kuba's user avatar
  • 137k
5 votes
Accepted

How do I include additional kinds of boxes that are Tab-selectable

You can utilize Placeholder option but it is undocumented. {InputField[], Style[1, Placeholder -> True], Placeholder[1]} If ...
Kuba's user avatar
  • 137k
4 votes
Accepted

Abort an EventHandler?

Shortly, use a SelectorPane and hide EventHandler as soon as the condition is met: ...
Kuba's user avatar
  • 137k
4 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, ...
b3m2a1's user avatar
  • 46.9k
4 votes
Accepted

How to implement LocatorAutoCreate functionality using EventHandler[]?

Does it fit your needs? ...
Kuba's user avatar
  • 137k
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 ...
kglr's user avatar
  • 395k
4 votes
Accepted

Make curve disappear gradually after Mouse Up

The problem is the clock only runs once and doesn't reinitialize. You'll also need to reset list to empty every time you click. Add: ...
N.J.Evans's user avatar
  • 5,093
3 votes
Accepted

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

Use <= instead of < here: ...
Chris Degnen's user avatar
  • 30.9k
3 votes

How to use an event handler inside of a Dialog Notebook

What if you did something like this: ...
ktm's user avatar
  • 4,242
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 ...
m_goldberg's user avatar
  • 108k
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. ...
William's user avatar
  • 7,605
3 votes

How to get what mouse button was pressed in EventHandler?

Update: A more streamlined version of the original post: ...
kglr's user avatar
  • 395k
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 ...
m_goldberg's user avatar
  • 108k
3 votes
Accepted

How to reset an event counter to zero after every nth evaluation while using Experimental`ValueFunction to observe for value changes in counter

As ordered :) ...
Daniel Huber's user avatar
  • 51.8k
2 votes

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

One way to fix the cursor bounding problem is to periodically force the cursor back to the center of the window. (I've seen this technique in OpenGL.) This way the cursor never leaves the area of the ...
Gyebro's user avatar
  • 386
2 votes

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

Work-arounds. kglr ...
2 votes

Abort an EventHandler?

There are a couple of issues. The floating-point arithmetic could result in a point close to (0, 0) without being equal to (0, 0). Use Chop. The ...
Edmund's user avatar
  • 42.3k
2 votes
Accepted

How to trigger an event whenever the variable controlled by an InputField is changed?

I think second argument to Dynamic of InputField should help you. With it n is updated to ...
BoLe's user avatar
  • 5,859
2 votes

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

This might work for you. Store the clicked color values by coordinate outside of dynamicPoint. ...
Mr.Wizard's user avatar
  • 272k
2 votes

Plot with different line style when clicked

Here's a way to do it by post-processing the Plot: ...
b3m2a1's user avatar
  • 46.9k
2 votes

Plotlabel in Monitor

As I read your problem you wanted to see all of the plots in the same window (it was not clear to me whether you wanted one plot at a time followed by a mouse click to change plots). This answer ...
Jack LaVigne's user avatar
  • 14.5k

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