Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: "SelectionData" and palettes

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99934] Re: [mg99882] "SelectionData" and palettes
  • From: John Fultz <jfultz at wolfram.com>
  • Date: Tue, 19 May 2009 06:48:48 -0400 (EDT)
  • Reply-to: jfultz at wolfram.com

On Mon, 18 May 2009 02:31:32 -0400 (EDT), meitnik wrote:
> With[ {p = ToExpression[CurrentValue[InputNotebook[],
>
> "SelectionData"]]},
> PresentTmpls[p]
>
> I found a similar code fragment on MathGroup. I wanted to use it in my
> palette. However, once the palette is standalone it fails to work;
> otherwise within a current session of a notebook it works fine. Is
> there a more stable way to grab a text selection so it can be used for
> further use in code? Thanks.
>
> Andrew

Works for me.  I don't know what you mean by "once the palette is standalone", 
though.  If you're fiddling with the palette's options, you need to make sure 
that WindowClickSelect->False remains in effect.  Otherwise, InputNotebook[]
could take on the value of your palette notebook, which you definitely don't
want.

And a more straightforward and documented way to do the same thing would be...

NotebookRead[InputNotebook[]]

Sincerely,
 
John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.




  • Prev by Date: Re: Use of names
  • Next by Date: Re: Followup quastion: Problem with parallel evaluation of integrals depending on a parameter
  • Previous by thread: Re: "SelectionData" and palettes
  • Next by thread: How to execute multiple statements from one SQLExecute?