MrKiloByte
MrKiloByte

Reputation: 57

Allow user to select text in ShowMessage dialog

I am writing a program in Delphi XE2. At one point in my program the user will be presented with output text, which I display through a simple "showmessage('The text of interest')" dialog.

I would like for the user to be able to copy and paste this text if they like to. It's not a key part of the program at all but I know that it might be nice for them to be able to do so.

At the moment, as far as I can see, it is not possible to select all or parts of the text from this type of message box, which brings me to my question: is there some way to make the message box text selectable for the user, or will I have to move on to other ways of displaying the text if I want this functionality? Any help would be greatly appreciated.

Upvotes: 4

Views: 2380

Answers (1)

David Heffernan
David Heffernan

Reputation: 613252

When you call ShowMessage a system message dialog is shown. This dialog does not support highlighting of individual portions of text. However, the dialog does respond to CTRL + C by placing the entire content of the dialog on the clipboard.

If you absolutely must have selection of individual portions of text then you will need to create the dialog yourself using Delphi controls.

Upvotes: 5

Related Questions