Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to make an InputField inside of a graphic active...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89596] Re: How to make an InputField inside of a graphic active...
  • From: Albert Retey <awnl at arcor.net>
  • Date: Sat, 14 Jun 2008 05:29:35 -0400 (EDT)
  • References: <g2th4e$7j4$1@smc.vnet.net>

David Reiss wrote:
> One can place, say, a Checkbox in a graphic using Inset:
> 
> Deploy[Graphics[{LightGray, Disk[], Inset[Checkbox[]]}]]
> 
> and the resulting Checkbox is active: i.e., you can click on it and
> the expected behavior happens.
> 
> Now if I try to do this with an InputField as in
> 
> Deploy[Graphics[{LightGray, Disk[], Inset[InputField[]]}]]
> 
> The resulting Inputfield cannot be accessed in the familiar way: i.e.,
> clicking inside of it and then typing.
> 
> Do the Group members have a suggestion for how to do this sort of
> thing with an InputField.
> 
> This, of course, is a distilled version of something else.  I am
> building a CAD application for a customer, and I would like to place
> input fields within the visual design that is being created so that
> values can be assigned to various things.  This behavior would be
> toggeled on and off as needed...
> 
> thanks for any help that you folks can give....

I think the problem is with Deploy, which AFAIK sets ContentSelectable
to False for Graphics. The following sets it to true for only the Inset
around the Inputfield which kind of works. I don't know whether that is
good enough for your customer, since you need to at least double klick
to select the text to edit, but not always, so it doesn't give a very
reliable impression, although I think the behavior is deterministic,
just not easy to follow...

text="hello";

Deploy@Graphics[{
LightGray,Disk[],
Black,Inset[InputField[Dynamic[text],String,Enabled->True],\
ContentSelectable->True]
}
]

Dynamic[text]

hth,

albert


  • Prev by Date: Re: Persistent addition to recently opened? Was Re: Notebooks location
  • Next by Date: Re: Re: 6.0.3
  • Previous by thread: Re: How to make an InputField inside of a graphic active...
  • Next by thread: Re: How to make an InputField inside of a graphic active...