# How to add a label to a CopyEvaluate button?

I found a definition of a button

Button[Defer[ Information[ \[SelectionPlaceholder], LongForm -> False]],
None, BaseStyle -> "CopyEvaluate"]


that is doing a good job.

How can I add a label to this button definition similar to Button[label, action]? I have trid to change the definition given above, but nothing I've done worked.

-
You are using a special pre-defined button style that gives special treatment to your button's label (Defer[Information[\[SelectionPlaceholder], LongForm -> False]]) is the label). This means you can't just add a lable to it. What you can do, if anything, to get the effect you want, I haven't figured out. – m_goldberg Aug 9 '13 at 0:47
@Liam. Button works fine on my system. – m_goldberg Aug 9 '13 at 0:49
@m_goldberg check edit history it didn't – William Aug 9 '13 at 1:03
I don't get it.. what is this button supposed to do? It looks like all it does is to print Information[#, LongForm -> False] when you press it. – bill s Aug 9 '13 at 2:33
It is an interesting problem if I have got it right. It appears to be able to give information about a selected text when the button is clicked! I agree with @m_goldberg that we are dealing with a button that uses a style and a special kind of label therefore I thought about using Interpretation or going to a more low-level function as ButtonBox. But, by now, I have nothing. My tests with Interpretation change the label but render the button useless. – Ailton Andrade de Oliveira Aug 9 '13 at 2:45

If you want to use BaseStyles like "CopyEvaluate" etc I'm afraid you have to stick to that:

Button[label,None,BaseStyle->stylename] inherits button functionality from the definition of stylename in thestylesheet. Such styles typically allow \[SelectionPlaceholder] to be used in label to represent the currently selected text.

So it is just the matter of the construct. However, you can mimic this behaviour:

 Button[
"the best label",
Information[Evaluate@CurrentValue["SelectionData"]]
]


-

This is very slightly better, perhaps?

Help[s_] := Information[s, LongForm -> False];
Button[Defer@Help[\[SelectionPlaceholder]], None,
BaseStyle -> "CopyEvaluate"]


-