Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

What I want is pretty simple, nevertheless, after half an hour I have only unsatisfying solutions here. Let me ask you who might work more often with Mathematica's GUI elements:

Is there a way to implement a dialog in Mathematica which works in general like the autocompletion popup.

enter image description here

The dialog doesn't has to popup automatically but it should have the following features:

  • it is a fixed list of entries, where the first entry is always selected and you can use the arrow keys to navigate up and down
  • on Enter or Esc the dialog closes where in the first case, some identifier with the selected entry is returned
  • I can use a unique "short-key" which lets me directly select and return one of the entries. So for instance if my list of choices is {"Module","Block","With"} I could use e.g. m, b and w to select the corresponding entry.

I have played with various dialogs, button bars and EventHandler without luck. Bevor I investigate further, I thought asking is probably the better choice.

share|improve this question
I once created a nice solution for this problem for one of my customers. I know that it was a rather lenghty function which took me hours of work. Thus, I think you are not underestimating the complexity of the problem. –  Ariel Sepulveda Jul 29 at 21:15
@ArielSepulveda I do have a hand-crafted list-dialog-clickedy-clack too for my symbol information palette but this lacks of the short-cuts and arrow keys. You always have to click. Additionally, and I haven't mentioned this here, I would like the dialog to popup at cursor (not mouse!) position. This seems impossible to achieve as far as I can tell. As always, if you want to do a real application with the dynamic UI elements it is never a one-line like advertised in the million toy-demonstrations. –  halirutan Jul 29 at 21:24
I'm not sure of what you mean by popup at cursor but maybe something can be done by means of InputField. You can move from one InputField to the next by using Tab, once you get to the desired field, typing the search string may be enough to dynamically popup the matches as a list and then use the arrow keys to navigate to the desired one, and finally, conclude the selection with a "ReturnKeyDown" which will be "collected" by the EventHandler. Thus, you may have to end up combining Dynamic with Button and EventHandler. Complicated? Yes, but maybe not impossible ;) –  Ariel Sepulveda Jul 29 at 21:45
@ArielSepulveda With popup at cursor I mean the behavior the autocompletion popup shows: It appears exactly beneath your current cursor position where you type. –  halirutan Jul 29 at 23:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.