Recent

Author Topic: [SOLVED] How to insert a greater space in TForm.Caption (Linux GTK2)?  (Read 975 times)

Hartmut

  • Hero Member
  • *****
  • Posts: 1028
I want to separate 2 infos in the Caption of a TForm with a greater space like "<info1>    <info2>". On Windows this is no problem, you can use normal blanks for that. But on Linux Ubuntu 24.04 with GTK2 there is always only 1 Blank displayed, even if I insert 5 of them. Using special UTF8-Blanks instead made no difference. I tried without success each 5 characters of:
#$C2#$A0
#$E2#$80#$80
#$E2#$80#$84
#$E2#$80#$86
#$E2#$80#$87
#$E2#$80#$8A
#$E3#$80#$80


Is it impossible to have a greater space in TForm.Caption on Linux GTK2?
Or which UTF8-code must I use?

I asked this question a longer time ago in another subforum but did not get even 1 answer. I hope for better results in this subforum. Thanks in advance.
« Last Edit: November 28, 2025, 09:26:44 am by Hartmut »

Thausand

  • Sr. Member
  • ****
  • Posts: 439
Re: How to insert a greater space in TForm.Caption (Linux GTK2)?
« Reply #1 on: November 23, 2025, 09:36:29 am »
I not know for great space. Have look picture attach. That is may be why is no answer. For me work GTK Linux same when describe Windows.

May be you Ubuntu have wayland no xorg ?
« Last Edit: November 23, 2025, 09:38:52 am by Thausand »

Thaddy

  • Hero Member
  • *****
  • Posts: 18483
  • Here stood a man who saw the Elbe and jumped it.
Re: How to insert a greater space in TForm.Caption (Linux GTK2)?
« Reply #2 on: November 23, 2025, 09:51:05 am »
Ubuntu LTS 24.04 defaults to Wayland indeed.
In your chars I miss simply #$20 A.K.A. space character a.k.a. #32: and THAT works.
« Last Edit: November 23, 2025, 09:54:09 am by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

Hartmut

  • Hero Member
  • *****
  • Posts: 1028
Re: How to insert a greater space in TForm.Caption (Linux GTK2)?
« Reply #3 on: November 23, 2025, 10:07:29 am »
Thanks for your replies. I did not imagine, that this issue might be related to the used window manager or Linux desktop. I use KDE plasma desktop which has Xorg as default. Sorry for not mentioned that. I search a solution for KDE plasma desktop with Xorg.

On Windows this is no problem, you can use normal blanks for that. But on Linux Ubuntu 24.04 with GTK2 there is always only 1 Blank displayed, even if I insert 5 of them.
As I wrote, I had tried normal blanks, but they did not work on Linux.
Tabs (#9) do not help.

Thausand

  • Sr. Member
  • ****
  • Posts: 439
Re: How to insert a greater space in TForm.Caption (Linux GTK2)?
« Reply #4 on: November 23, 2025, 10:20:41 am »
Thank Thaddy for confirm

@Hartmut
Is many different xorg vs wayland. Then make assume this is problem. I have make picture test and use mate/xorg.

KDE then can have problem other. GTK have own title-bar draw and KDE have own title-bar draw (KDE can custom decor draw).

I no have experience KDE but may be can have look/search Client Side Decoration (CSD). If use GTK when have KDE then GTK have look GTK when have GTK decoration for KDE when GTK compatible. If have decoration no compatible GTK then can have problem (because I no KDE experience I not know detail how this is work).

May be other user have know for this ?
« Last Edit: November 23, 2025, 10:23:06 am by Thausand »

Hartmut

  • Hero Member
  • *****
  • Posts: 1028
Re: How to insert a greater space in TForm.Caption (Linux GTK2)?
« Reply #5 on: November 23, 2025, 11:32:14 am »
Thanks Thausand. I did not understand all what you wrote because my knowledge about this special stuff is like zero. AFAIK I do not have "KDE custom decor draw" or "Client Side Decoration (CSD)" and I don't want to install or "activate" this. Is it possible to have a greater space in TForm.Caption on Linux GTK2 with KDE and Xorg nevertheless? E.g. only by using the "right" UTF8-Codes?

Thausand

  • Sr. Member
  • ****
  • Posts: 439
Re: How to insert a greater space in TForm.Caption (Linux GTK2)?
« Reply #6 on: November 23, 2025, 12:13:31 pm »
I not understand. When make choice KDE then have make choice for not agree gnome draw. KDE make own decor and not use gnome default. Is no wrong but I think is need and have know this. Client Side Decoration https://en.wikipedia.org/wiki/Client-side_decoration

I not know KDE but I make for search screenshot and have see KDE decor have option titlebar spacing. I not know if have option for set ignore/eat space. https://discuss.kde.org/t/no-titlebars-except/26283

May be can have try and make change setting and make decor fix for space ?
« Last Edit: November 23, 2025, 12:15:05 pm by Thausand »

Hartmut

  • Hero Member
  • *****
  • Posts: 1028
Re: How to insert a greater space in TForm.Caption (Linux GTK2)?
« Reply #7 on: November 23, 2025, 01:41:08 pm »
Thanks again Thausand. I checked both links. I understood that maybe using and configuring "Client Side Decoration" might help. And I checked my KDE settings, but did not find an option for ignore/eat spaces.

I don't want to invest too much effort in this small "gimmick". It would be nice but it is not important. If the right UTF8-code would help, I would be happy. But I don't want to install / configure / test "Client Side Decoration", which might work or not (and even if yes, only on my computer and not for other users).

Hartmut

  • Hero Member
  • *****
  • Posts: 1028
Re: How to insert a greater space in TForm.Caption (Linux GTK2)?
« Reply #8 on: November 28, 2025, 09:26:24 am »
I found a very good solution: instead of blanks I use multiple occurrences of #$C2#$80 + ' '.

#$C2#$80 shows nothing (no character and no space), but it prevents, that multiple 'blanks' in TForm.Caption are reduced to only 1 blank.

Ten_Mile_Hike

  • Full Member
  • ***
  • Posts: 127
Re: [SOLVED] How to insert a greater space in TForm.Caption (Linux GTK2)?
« Reply #9 on: November 28, 2025, 06:30:27 pm »
Remember that on Windows (and I am guessing on Linux) that Char(255) [extended ASCII] will allow you to put a space character in places where char(32) is forbidden
When any government, or any church for that matter, undertakes to say to its subjects, This you may not read, this you
must not see, this you are forbidden to know, the end result is tyranny and oppression no matter how holy the motives.

Robert A. Heinlein

Hartmut

  • Hero Member
  • *****
  • Posts: 1028
Re: [SOLVED] How to insert a greater space in TForm.Caption (Linux GTK2)?
« Reply #10 on: November 29, 2025, 10:11:48 am »
Char(255) in TForm.Caption shows a "?" in Windows and Linux (see screenshot).

Ten_Mile_Hike

  • Full Member
  • ***
  • Posts: 127
Re: [SOLVED] How to insert a greater space in TForm.Caption (Linux GTK2)?
« Reply #11 on: November 30, 2025, 09:38:53 pm »
change your codepage in your code...All will be well
When any government, or any church for that matter, undertakes to say to its subjects, This you may not read, this you
must not see, this you are forbidden to know, the end result is tyranny and oppression no matter how holy the motives.

Robert A. Heinlein

Hartmut

  • Hero Member
  • *****
  • Posts: 1028
Re: [SOLVED] How to insert a greater space in TForm.Caption (Linux GTK2)?
« Reply #12 on: December 01, 2025, 10:42:48 am »
What do you mean? To change the codepage of my sourcecode? For using Char(255)?

AFAIK TForm.Caption needs UTF8 and Char(255) is not UTF8 so I can't imagine that/how this should work.

Ten_Mile_Hike

  • Full Member
  • ***
  • Posts: 127
Re: [SOLVED] How to insert a greater space in TForm.Caption (Linux GTK2)?
« Reply #13 on: December 01, 2025, 09:01:08 pm »
@Hartmut

You are correct. Lazarus is Unicode (UTF-16), and it does not display or preserve 8-bit ANSI bytes above 127.
Characters like #255 are interpreted as Unicode; therefore the VCL replaces unprintable characters with '?' (63), which is exactly what you are seeing.

Years ago, before unicode, this trick used to work, but not anymore.

However on Win11 you can still put the "space" character (ANSI #255) in file and folder names even as the first character by holding down <ALT> and pressing 2-5-5 on the numeric keypad. I just tested it and that works.
So there's that at least.
When any government, or any church for that matter, undertakes to say to its subjects, This you may not read, this you
must not see, this you are forbidden to know, the end result is tyranny and oppression no matter how holy the motives.

Robert A. Heinlein

Hartmut

  • Hero Member
  • *****
  • Posts: 1028
Re: [SOLVED] How to insert a greater space in TForm.Caption (Linux GTK2)?
« Reply #14 on: December 02, 2025, 01:00:51 pm »
I wrote in my very first post:
Quote
On Windows this is no problem, you can use normal blanks for that.
So on Windows there is no need for any workaround like using #255 instead of normal blanks.

 

TinyPortal © 2005-2018