Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ShowMessage in Delphi XE5 Shortended

ShowMessage() in Delphi XE5 shortens text.

Is this new to me, or it is due to the encoded characters when encoding a url? I need to see the entire thing.

I use the following function to encode my url:

function TConnector.EncodeUrl(aDecodedUrl: String): String;
begin
  result:= tIdUri.URLEncode(aDecodedUrl);
end;

I then call in here:

zEncodedUrl := Connector.EncodeUrl('http://' + Connector.Host + 'Node:' + edtPath.Text + '.GetObjectListDataAsJSON');

EDIT: And I get this when passed to ShowMessage:

screenshot

I should note that when debugging and placing my mouse over the zEncodedUrl variable, it shows the full thing.

like image 206
LIVESTUFF Avatar asked Nov 08 '13 19:11

LIVESTUFF


1 Answers

That's the native behaviour of the Vista task dialog, at least as called by Delphi. And the Vista task dialog is what gets called when you call ShowMessage on Windows. It will not split lines that are too long. If your text included a space, it would be split.

A simple workaround would be to call good old MessageBox.

MessageBox(Application.MainForm.Handle, PChar(Message), PChar(Caption), MB_OK);

You may want to fine-tune the choice of owner HWND to pass, but you get the idea.

like image 74
David Heffernan Avatar answered Nov 03 '22 22:11

David Heffernan