MathGroup Archive 2009

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

Search the Archive

SelectionMove[] busted with InputField and DockedCells?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104590] SelectionMove[] busted with InputField and DockedCells?
  • From: Jason Ledbetter <jasonbrent at gmail.com>
  • Date: Wed, 4 Nov 2009 01:38:30 -0500 (EST)

Folk,

The following example produces a docked panel with an input field, a button
and popup menu.  The intended workflow is for the user to enter some content
in the field, select the button and then choose an action from the popup
menu which should produce output in the notebook based on the input content.
However, the output is going into the input field and I've not been able to
figure out how to move to the rest of the notebook.

In the 'write' function, I'm trying to use SelectionMove[] to move past the
docked cell and generate the output. However, this doesn't work with
"After,Notebook" (or Cell, CellGroup, etc..).

In this example, I've purposefully exposed nb and write outside of the
module....

--snip--

Remove[write, nb];
Module[{x, stuff, list},
 stuff = Null;
 list = {Null};
 nb = CreateDocument[];

 dockConfig = Cell[
   BoxData[ToBoxes@DynamicModule[{},
      Panel@
       Row[{InputField[Dynamic@stuff], Button["fill list", list =
Range[10]],
         Dynamic@
          PopupMenu[
           Dynamic[x, (x = #; write["written", x]) &], # -> # & /@
            list]}]]]];

 SetOptions[nb, DockedCells -> dockConfig];

 write[stuff_String, times_] :=
  Module[{}, SelectionMove[nb, After, Notebook];
   Table[NotebookWrite[nb, {Cell[stuff]}], {times}]];
 ]

--snip--



Once the new window is open, place the cursor in the inputfield, then click
"fill list", then select any option in the pulldown and you can see the
output going into the inputfield.

If you don't place the cursor in the input field, select "fill list" then
select any option in the pulldown, I get the expect results.

How can I "SelectionMove" past this input field or is that the wrong
approach?

Thanks,

-jbl



  • Prev by Date: Problems with absolute PlotRange
  • Next by Date: Cylinder cylinder intersection: Design of a starter crank.
  • Previous by thread: Re: Problems with absolute PlotRange
  • Next by thread: Cylinder cylinder intersection: Design of a starter crank.