PeterPanettone 158 Posted July 8, 2020 (edited) In Delphi 10.4, is there a way to increase the narrow space between the TCheckBox glyph and the checkbox caption text? The WordWrap property of TCheckBox is set to True. Edited July 8, 2020 by PeterPanettone Share this post Link to post
Rollo62 539 Posted July 8, 2020 Are looking after FMX ? You can use the Edit custom style, to prepare a customized version Or you can use OnApplyStyleLookup, where you can grab the single elements from above, e.g. by usng FindStyleResource('text') ... When you looking for VCL, probably you have to create you own custom component, or you simply use ' ' space, to get more distance tho the checkbox. Share this post Link to post
Sherlock 663 Posted July 8, 2020 4 minutes ago, Rollo62 said: When you looking for VCL, probably you have to create you own custom component, or you simply use ' ' space, to get more distance tho the checkbox. That will fail quickly for word wrapped captions. Share this post Link to post
Attila Kovacs 631 Posted July 8, 2020 (edited) 2 hours ago, Sherlock said: That will fail quickly for word wrapped captions. Only if the text is dynamic or multilang. So in 99.99% the cases could work. Caption = ' Unga'#13#10' Bunga' WordWrap = True Edited July 8, 2020 by Attila Kovacs 2 Share this post Link to post
Remy Lebeau 1436 Posted July 8, 2020 For VCL, you could set the button to owner-draw and then manually draw your own check box however you want, then you can include more spacing in the drawing. However, you would have to do this at the Win32 API layer, not at the VCL layer. Share this post Link to post
Lars Fosdal 1793 Posted July 9, 2020 Well, what do you know! I actually didn't know you could wordwrap a checkbox caption! Thanks, @Attila Kovacs! 1 Share this post Link to post
Remy Lebeau 1436 Posted July 9, 2020 10 hours ago, Lars Fosdal said: Well, what do you know! I actually didn't know you could wordwrap a checkbox caption! The WordWrap property was added to TButtonControl (which TCheckBox derives from) in Delphi 7. All it does is enables the BS_MULTILINE window style on the control, so it is possible to enable this style manually in earlier Delphi versions, too. Share this post Link to post
aehimself 399 Posted July 9, 2020 On 7/8/2020 at 5:09 PM, Attila Kovacs said: Caption = ' Unga'#13#10' Bunga' WordWrap = True Holy Frank, this smells. I already learned not to use whitespaces for distancing back in high school. And while it might work - can you please check if the above functions correctly if "Width = 30" for example? Share this post Link to post
Attila Kovacs 631 Posted July 9, 2020 of course does it work, just set the font size to 2. what is your problem? 1 Share this post Link to post
Attila Kovacs 631 Posted July 9, 2020 btw. how did you separate the words back in the high school? Share this post Link to post
aehimself 399 Posted July 9, 2020 2 minutes ago, Attila Kovacs said: what is your problem? Nothing, really. As smart people say "if it works it ain't stupid". It's a perfect quick-and-dirty solution which will achieve what you want in this, very specific project and configuration. Lately I like to think in general solutions, that's all. And that is custom drawing. Share this post Link to post
aehimself 399 Posted July 9, 2020 6 minutes ago, Attila Kovacs said: btw. how did you separate the words back in the high school? I might not phrased myself correctly - forgive me; English is not my native language. The point is, you know exactly what I meant by "distancing". Let's play adults and not starting to argue on choice of words. 1 Share this post Link to post
Attila Kovacs 631 Posted July 9, 2020 All good. It was in my comment that this is only for static text, and if you would argue then you should have asked what if somebody want 2.5 x space distance 😉 Share this post Link to post
aehimself 399 Posted July 9, 2020 No insult taken. My attention may have slipped - I did not see the static part and for that I apologize. For the record, my intention was not to argue: I just had to refactor too many lines of code (written 10-15 years ago) which broke or misbehaved on specific modern systems. The days-weeks wasted there taught me to proudly waste hours when I write fresh code which will still work the same way everywhere in the foreseeable future. Do I still have "hacks" like this in production? Hell yes, I do. Do I hate myself for it when I see it? That's a question for a different topic 🙂 2 Share this post Link to post
Lars Fosdal 1793 Posted July 10, 2020 There are numerous Unicode white space chars of varying width, so adjusting the distance "by character" is possible. Share this post Link to post
Rollo62 539 Posted July 10, 2020 12 hours ago, aehimself said: Do I still have "hacks" like this in production? Hell yes, I do. Do I hate myself for it when I see it? That's a question for a different topic 🙂 Don't mess with youself too much, if Microsoft shows not any attempt to make these controls practically more usable since the last 20+ years, why should we do ? I must really say that meanwhile I hate to fix all the quirks in OS, IDE, tools, libraries, etc. Enough to do with my own, selfmade errors 3 Share this post Link to post
Sherlock 663 Posted July 10, 2020 12 minutes ago, Rollo62 said: Don't mess with youself too much, if Microsoft shows not any attempt to make these controls practically more usable since the last 20+ years, why should we do ? I must really say that meanwhile I hate to fix all the quirks in OS, IDE, tools, libraries, etc. Enough to do with my own, selfmade errors And in the end, what is the effort worth? Just to say: "In my product 1+1 is still 2 but it looks better than the others". Share this post Link to post
aehimself 399 Posted July 10, 2020 5 hours ago, Lars Fosdal said: There are numerous Unicode white space chars of varying width, so adjusting the distance "by character" is possible. In my opinion, just because there's a possibility to do something doesn't mean you should use it 🙂 2 hours ago, Rollo62 said: Don't mess with youself too much, if Microsoft shows not any attempt to make these controls practically more usable since the last 20+ years, why should we do ? 2 hours ago, Sherlock said: And in the end, what is the effort worth? Just to say: "In my product 1+1 is still 2 but it looks better than the others". I do understand and agree with you on this. But it's not for the others, it's because of my own self. I just don't want to produce code I don't like or as "time-resistant" as I can think of. Whilst it's a good thing it's a curse as well... I can easily waste hours on a single "Hello World" application this way. 1 Share this post Link to post