MathGroup Archive 2012

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

Search the Archive

Re: How to create palette buttons with tooltips?

  • To: mathgroup at
  • Subject: [mg124175] Re: How to create palette buttons with tooltips?
  • From: Leonid Shifrin <lshifr at>
  • Date: Wed, 11 Jan 2012 17:21:39 -0500 (EST)
  • Delivered-to:
  • References: <>

Hi Szabolcs,

Why not use run-time code generation?

SetAttributes[withPaletteButtons, HoldFirst];
withPaletteButtons[code_, tooltipFunction_: First] :=
  Unevaluated[code] /.
   HoldPattern[Button[args__, opts : OptionsPattern[]]] :>
    Tooltip[Button[args, Appearance -> "Palette",opts],
     tooltipFunction[Hold[args]], TooltipDelay -> Automatic];

You use it as:

 CreatePalette[{Button["Button1"], Button["Button2"]}]]


On Wed, Jan 11, 2012 at 2:00 PM, Szabolcs <szhorvat at> wrote:

> What is the most convenient way to create palette buttons with tooltips
> that use the OS-wide tooltip delay?
> Currently I am using
> CreatePalette@
>  Tooltip[Button["Button", Appearance -> "Palette"], "Tooltip",
>  TooltipDelay -> Automatic]
> But this seems like a lot of work (both TooltipDelay -> Automatic and
> Appearance -> "Palette" needed) just to get the behvaiour which could be
> expected as a default from a palette.
> When I have several buttons, what's the simplest and most concise way to
> do this?

  • Prev by Date: Re: Unit testing using imported data
  • Next by Date: Re: Integrate function defined by numerical integration
  • Previous by thread: How to create palette buttons with tooltips?
  • Next by thread: Re: How to create palette buttons with tooltips?