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

MathGroup Archive 2010

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

Search the Archive

Re: SelectionMove[] busted with InputField and DockedCells?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114334] Re: SelectionMove[] busted with InputField and DockedCells?
  • From: Jason Ledbetter <jasonbrent at gmail.com>
  • Date: Wed, 1 Dec 2010 02:12:41 -0500 (EST)

For posterity....

This particular issue/example seems to be resolved in M8.

I'm happy to find that code I wrote over a year ago now works as I expected
it to in M8. :-)

-jbl

On Wed, Nov 4, 2009 at 1:38 AM, Jason Ledbetter <jasonbrent at gmail.com>wrote:

> 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: Re: multiple outputs from compiled function
  • Next by Date: Re: Pass by reference for compiled functions
  • Previous by thread: Re: multiple outputs from compiled function
  • Next by thread: Re: Pass by reference for compiled functions