PB6.0 Raspberry Pi Bullseye x32 StringGadget with #PB_Text_Center Fails

Just starting out? Need help? Post your questions and find answers here.
PitH
User
User
Posts: 16
Joined: Sun Jan 16, 2022 6:12 am

PB6.0 Raspberry Pi Bullseye x32 StringGadget with #PB_Text_Center Fails

Post by PitH »

OS x32
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian

A normal TextGadget like this

TextGadget(#Text_Line3, 120, 60, 650, 25, "", #PB_Text_Center)

works fine

A StringGadget like this

StringGadget(#String_Line1, 120, 110, 650, 25, "", #PB_Text_Center)

Doesn't work, the cursor position is on the far left , no typed letters are shown and a Entity_ID$ = GetGadgetText(#String_Line1)
results into an empty Entity_ID$.

If you change the line to
StringGadget(#String_Line1, 120, 110, 650, 25, "")

Works fine, typed text shows up on the left and the variable Entity_ID$ = GetGadgetText(#String_Line1)
is filled correctly.
User avatar
jacdelad
Addict
Addict
Posts: 2004
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: PB6.0 Raspberry Pi Bullseye x32 StringGadget with #PB_Text_Center Fails

Post by jacdelad »

#PB_Text_... indicates that this style is only valid for TextGadgets, not StringGadgets! Not a bug, the help nowhere suggests using this constant with any other control.
...now I understand your problem from your other thread. :D
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
PitH
User
User
Posts: 16
Joined: Sun Jan 16, 2022 6:12 am

Re: PB6.0 Raspberry Pi Bullseye x32 StringGadget with #PB_Text_Center Fails

Post by PitH »

With Windows x86 and x64 PB6.0 versions it works ,
give it a try.
User avatar
jacdelad
Addict
Addict
Posts: 2004
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: PB6.0 Raspberry Pi Bullseye x32 StringGadget with #PB_Text_Center Fails

Post by jacdelad »

Yeah I did, see the other thread. But it shouldn't, or let's say, it's a coincidence:
#PB_Text_Center has the value "1" which is the same as #ES_CENTER, which is used to center StringGadgets on Windows (it is a Windows constant, which is not defined on Linux!). I don't know which constant Linux uses to center text.
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
User avatar
Shardik
Addict
Addict
Posts: 2059
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: PB6.0 Raspberry Pi Bullseye x32 StringGadget with #PB_Text_Center Fails

Post by Shardik »

jacdelad wrote: Wed Jan 11, 2023 2:01 am I don't know which constant Linux uses to center text.
You may take a look into this cross-platform example.
Post Reply