Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7751
| From | Leonid Shifrin <lshifr@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: How to create palette buttons with tooltips? |
| Date | 2012-01-11 22:23 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jel24i$lmb$1@smc.vnet.net> (permalink) |
| References | <201201111100.GAA13183@smc.vnet.net> |
Hi Szabolcs,
Why not use run-time code generation?
ClearAll[withPaletteButtons];
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:
withPaletteButtons[
CreatePalette[{Button["Button1"], Button["Button2"]}]]
Cheers,
Leonid
On Wed, Jan 11, 2012 at 2:00 PM, Szabolcs <szhorvat@gmail.com> 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?
>
>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: How to create palette buttons with tooltips? Leonid Shifrin <lshifr@gmail.com> - 2012-01-11 22:23 +0000
csiph-web