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.