2
$\begingroup$

I'm trying to popup a window with a list of strings that I can then individually select and copy to the clipboard. Using CreateDialog I can select items formatted as a Quantity but not simple text. In the example below I can right click and copy the 1kg entry, but not the Hello text. I tried a few Copyable/Selectable options with no luck. Is there a way to make the text selectable in a CreateDialog?

CreateDialog[{"Hello", Quantity[1, "Kilograms"]}, ContentSelectable -> True, Copyable -> True, Selectable -> True];

enter image description here

$\endgroup$
2
$\begingroup$

Setting the option Deployed to False seems to do the trick, someone else will have to say why though.

CreateDialog[
    {
        "Hello",
        Quantity[1, "Kilograms"],
        Style["bob", ShowStringCharacters -> True]
    },
    Deployed -> False, Selectable -> True
]

enter image description here

|improve this answer|||||
$\endgroup$
  • $\begingroup$ Very good! It is odd that "Quantity"s are selectable without that, even with Selectable and Copyable set to False. $\endgroup$ – DrBubbles May 9 '19 at 19:57
  • 1
    $\begingroup$ I think that is because the normal formatting for Quantity has both a tooltip and specially defined right-click behavior, and the dialog doesn't suppress that. $\endgroup$ – Jason B. May 9 '19 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.