PeterPanettone 158 Posted March 27 (edited) At design-time: procedure TForm1.FormCreate(Sender: TObject); begin Button1.Caption := 'Back' + #13#10 + 'to Editor'; end; At run-time: TButtonMultiLineCaptionTest.zip Can anyone confirm this? Is there a working "Quality Portal" where this can be reported? Edited March 27 by PeterPanettone Share this post Link to post
MarkShark 27 Posted March 27 Is this with Delphi 12 - Athens? Could it be related to this issue mentioned on Stack Overflow? To test if that's the issue just try changing #13#10 to + #13 + #10 to see if it makes a difference. Stack Overflow: Issue related to character literals: https://stackoverflow.com/a/78186835/113128 Share this post Link to post
Lajos Juhász 295 Posted March 27 (edited) You can solve this problem, set Wordwrap to true. It is event documented: Vcl.StdCtrls.TButton.WordWrap inherits from Vcl.StdCtrls.TButtonControl.WordWrap. All content below this line refers to Vcl.StdCtrls.TButtonControl.WordWrap. Specifies whether the button text wraps to fit the width of the control. Set WordWrap to true to allow the display of multiple lines of text. When WordWrap is true, text that is too wide for the control wraps at the right margin. Set WordWrap to false to limit the text to a single line. When WordWrap is false, text that is too wide for the control appears truncated. Edited March 27 by Lajos Juhász copied from help. Share this post Link to post
PeterPanettone 158 Posted March 27 In TRzButton the Multi-Line Caption works without having to explicitly set WordWrap = True: Share this post Link to post
PeterPanettone 158 Posted March 27 (edited) 23 hours ago, Lajos Juhász said: When WordWrap is true, text that is too wide for the control wraps at the right margin. This is not concisely logical, as it should word-wrap the Caption when the "text is too wide for the control" AND NOT PREVENT the word-wrap when it is already Multi-Line (if WordWrap = False). And, from a purely practical point of view, what sense would it make to explicitly truncate the text if it's too large for the control? Wouldn't it rather be more practical to automatically word-wrap the Caption when the text is too large for the control? Edited March 28 by PeterPanettone Share this post Link to post
PeterBelow 239 Posted March 27 2 hours ago, PeterPanettone said: This is not concisely logical, as it should word-wrap the Caption when the "text is too wide for the control" AND NOT PREVENT the word-wrap when it is already Multi-Line (if WordWrap = False). And, from a purely practical point of view, what sense would it make to explicitly truncate the text if it's too short for the control? Wouldn't it rather be more practical to automatically word-wrap the Caption when the text is too short for the control? It may not be logical but Windows has a lot of these little inconsistencies that have accumulated over time by bolting more functionality on existing control classes. TButton is a wrapper around the Windows button control, and its behaviour is determined by the set of button control styles, in this case the BS_MULTILINE style, which the Multiline property surfaces. Share this post Link to post
PeterPanettone 158 Posted March 27 2 minutes ago, PeterBelow said: Windows has a lot of these little inconsistencies that have accumulated over time by bolting more functionality on existing control classes. You are right - one should write a book about this topic. Share this post Link to post
Remy Lebeau 1436 Posted March 27 6 hours ago, MarkShark said: Is this with Delphi 12 - Athens? Could it be related to this issue mentioned on Stack Overflow? To test if that's the issue just try changing #13#10 to + #13 + #10 to see if it makes a difference. Stack Overflow: Issue related to character literals: https://stackoverflow.com/a/78186835/113128 That is a completely different issue. I don't see how that applies here. 1 Share this post Link to post
Anders Melander 1815 Posted March 27 8 hours ago, PeterPanettone said: one should write a book about this topic One did Share this post Link to post