Multiline button caption - can't figure out how to do lazarus / 10-Designer ---------------------------------------------------------------------- Paul-SFL · 2011-09-17 21:20 Hello, I'm completely new to Delphi and Lazarus (I only studied Turbo Pascal), so I ask for help here. I cannot understand how to make button caption multiline; Google haven't helped and manuals too. Can anyone please tell me what should I do or where can I find examples? ---------------------------------------------------------------------- typo · 2011-09-17 21:32 Use a TSpeedButton with an image. You can do also: Code: [Select]SpeedButton1.Caption := 'a' +#13#10 + 'b'; ---------------------------------------------------------------------- Paul-SFL · 2011-09-17 21:50 Thanks, I'll try it. As for code you wrote, where should I insert it? Into some procedure related to form creation? ---------------------------------------------------------------------- typo · 2011-09-17 21:52 Yes. ---------------------------------------------------------------------- Paul-SFL · 2011-09-17 22:10 Ok, that's all for the moment. Going to try your advice tomorrow. ---------------------------------------------------------------------- Paul-SFL · 2011-09-18 16:44 Thank you typo, the code works . ---------------------------------------------------------------------- felipemdc · 2011-09-18 18:48 don't use #13#10, use the constant LineEnding instead ---------------------------------------------------------------------- Paul-SFL · 2011-09-18 19:43 Thanks for the advice, but I can see no essential difference . Am I mistaken? ---------------------------------------------------------------------- mdalacu · 2011-09-18 19:54 Windows / Linux difference . No CR on Linux. ---------------------------------------------------------------------- IPguy · 2011-09-18 23:53 This works in windows.  I have not tried it with *nix. Code: [Select]  SpeedButton1.Caption := 'Row1' + sLineBreak + 'Row2'; ---------------------------------------------------------------------- Bandbaz · 2011-09-19 06:35 Code: [Select]SpeedButton1.Caption := 'Row1' + sLineBreak + 'Row2'; SpeedButton2.Caption := 'Row1' + LineEnding + 'Row2'; SpeedButton3.Caption := 'Row1' + #13#10 + 'Row2'; none of them works for me lazarus 0.9.30 gtk2 ubuntu 11.4 ---------------------------------------------------------------------- Bandbaz · 2011-09-19 09:33 I tried again on TButton and TBitBtn all 3 codes working good! so, maybe you should not use SpeedButton if you don't have image on it. lazarus 0.9.30 gtk2 ubuntu 11.4 ---------------------------------------------------------------------- Zoran · 2011-09-19 10:51 Quote from: Paul-SFL on September 18, 2011, 09:43:45 pmThanks for the advice, but I can see no essential difference . Am I mistaken? LineEnding is mapped to #13#10 in Windows, #10 in Linux and #13 in Mac. If you want your code to be cross platform, do not use hard-coded values, but always use cross-platform constants instead. See: http://wiki.lazarus.freepascal.org/End_of_Line See also: http://wiki.lazarus.freepascal.org/Multiplatform_Programming _Guide#Working_with_files_and_folders ---------------------------------------------------------------------- Blaazen · 2011-09-19 11:45 Code: [Select]....  .Caption := 'Row1' + LineEnding + 'Row2';For me works for all three, TButton, TBitBtn and TSpeedButton (Linux+Qt). ---------------------------------------------------------------------- Paul-SFL · 2011-09-19 16:52 Thank you all for the explanation guys . Though I'm writing a Windows program, I'm going to follow your advice.