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.

I am building a model for which the user can enter parameter values. I would like to create a "graphical layout" of the model in which I display several InputField-s to enter the numerical parameters, arranged to be shown at the appropriate x-y-locations in my "graphical layout". However, InputFields appear to become non-editable when part of a Graphics object.

For example, the following works (of course):

InputField[Dynamic[x]]

However, the next command creates an InputField that cannot be accessed, although the dynamic value still correctly updates when you change the InputField created by the previous command:

Graphics[Inset[InputField[Dynamic[x]]]]

How can I place InputFields at specific coordinates in (or on top of) a Graphics?

share|improve this question
    
@Nasser Yes, this seems to work. I have tried Graphics[...,Deployed->True], which does not work. Please, put it as an answer, then I can accept. –  Thomas Aug 2 '13 at 18:36
add comment

2 Answers 2

up vote 4 down vote accepted
Deploy@Graphics[Inset[InputField[Dynamic[x]]]]

Can be used to allow input to a field inside Graphics

share|improve this answer
add comment

Sometimes Text is easier to place.

Deploy @ Graphics[{Circle[], Red, PointSize[Large], 
   Dynamic @ Point[{x, 0}], Text[InputField[Dynamic[x]], {0, 0.8}]}]

Mathematica graphics

By the way, without the Deploy, you can edit the InputField this way. Double-click over the InputField; then double-click again. You should be able to edit the InputField.

Note: Without Deploy the user can edit the graphics, too. Usually, with user interfaces, this undesirable. In such cases you should use Deploy anyway.

share|improve this answer
1  
Isn't Text implemented as Inset since version 6? You can replace Text with Inset above and it behaves the same. –  Mr.Wizard Aug 4 '13 at 3:15
    
@Mr.Wizard I did not know that. The docs describe them differently (both arguments and function, which is only said to be "similar"), but, checking out combinations of arguments, they in fact they seem have the same syntax and semantics. Thanks! The docs made Inset harder for me to understand, and I've harbored a prejudice until now. One instance: if the Inset argument opos had been described as well as offset for Text, it would have saved me trouble. The argument size for Inset, omitted in the description for Text, does not always behave how I expect it. –  Michael E2 Aug 4 '13 at 13:17
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.