MathGroup Archive 2010

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

Search the Archive

CreatePalette and Button "click" functions?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114881] CreatePalette and Button "click" functions?
  • From: Jason Ledbetter <jasonbrent at gmail.com>
  • Date: Tue, 21 Dec 2010 00:20:01 -0500 (EST)

Folk,

I'm working on a custom palette for an application I'm writing and noticed
that when I have more than one button in the palette (!) that the visible
"click" function doesn't always work.

The helpfile ref/CreatePalette has an example in it that demonstrates this
problem.

--snip--

CreatePalette[{Button["Shout!",
    NotebookWrite[InputNotebook[],
     ToUpperCase[NotebookRead[InputNotebook[]]]]],
   Button["Quiet",
    NotebookWrite[InputNotebook[],
     ToLowerCase[NotebookRead[InputNotebook[]]]]]}];

--snip--


This opens a 2 button palette and only the "quiet" button visually APPEARS
clicked when it is clicked. The top "Shout!" button will only appear clicked
if you first highlight some text in an open document then click "shout!"....
and at that point the bottom button won't appear visually clicked.


An even simpler one to ensure this isn't due to the function of that
particular example requiring text to be highlighted:



CreatePalette[{Button["one", Print["one"]], Button["two", Print["two"]]}]


To see the output here, ensure that you have Window->Messages opened then
click "One" followed by "Two". You'll notice that both produce output in
Messages but only the first button clicked will produce the visual highlight
of a down-press on the mouse.


Basically, whichever button is clicked first when the parent notebook is
opened is the only one that will show the visual highlight when the mouse
button is clicked.


Is there any way around this visual anomaly?


Thanks,


-jbl



  • Prev by Date: Re: switching between versions 7 and 8
  • Next by Date: Re: switching between versions 7 and 8
  • Previous by thread: Mathematica 8 Executable (how much gets added to them)
  • Next by thread: The size of image output