Message Boards Message Boards

0
|
5261 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

Question about CreatePalette

Hi,

I have a lot of utility functions that I'd like to make into an Algebraic Manipulation Extras.

For example, it would be nice to have a crossMultiply:

crossMultiply[a_==b_]:=Numerator[a] Denominator[b]==Numerator[b] Denominator[a]
CreatePalette[PasteButton[crossMultiply[\[SelectionPlaceholder]]]];

This doesn't work like the Algebraic Manipulation palette: it correctly does the substitution:

a/b == c/d
crossMultiply[a/b == c/d]
a d == b c

when a/b == c/d is highlighted, but it returns the function crossMultiply[a/b == c/d] which then has to be shift/entered to evaluate.

Nothing I do can get it to evaluate automatically, which the description of PasteButton would seem to warrant. Any suggestions?

Thanks,

Eric

POSTED BY: Eric Johnstone

The solution was in tutorial/CreatingPalettes:

CreatePalette@
    Button[Defer[#[\[SelectionPlaceholder]]], Inherited, 
     BaseStyle -> "Evaluate", Evaluator -> None, 
     Appearance -> "Palette"] & /@ {crossMultiply};

Eric

POSTED BY: Eric Johnstone
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract