GetGadgetItemText() doesn't work with wrapped text in EditorGadget

Post bugreports for the Linux version here
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

GetGadgetItemText() doesn't work with wrapped text in EditorGadget

Post by Shardik »

When using GetGadgetItemText() to read a text line in a wrapped text block from an EditorGadget with flag #PB_Editor_WordWrap, in Linux (GTK2 and GTK3) the whole wrapped text block is returned in line 0 (in Windows it works as expected).

In Tricks 'n' Tips I have posted this cross-platform workaround.
User avatar
Sicro
Enthusiast
Enthusiast
Posts: 559
Joined: Wed Jun 25, 2014 5:25 pm
Location: Germany
Contact:

Re: GetGadgetItemText() doesn't work with wrapped text in EditorGadget

Post by Sicro »

Code: Select all

; PureBasic 6.20 Beta 4 (x64) - Linux
; gtk3: bug
; gtk2 and qt: no bug

#Window = 0
#EditorGadget = 0

If Not OpenWindow(#Window, 0, 0, 500, 500, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  Debug "Error: OpenWindow()"
  End
EndIf

; Without the flag '#PB_Editor_WordWrap', it works.
EditorGadget(#EditorGadget, 0, 0, WindowWidth(#Window), WindowHeight(#Window), #PB_Editor_WordWrap)
;EditorGadget(0, 0, 0, WindowWidth(0), WindowHeight(0))

AddGadgetItem(#EditorGadget, -1, "item text")

Debug CountGadgetItems(#EditorGadget) ; Returns: 9
Debug GetGadgetItemText(#EditorGadget, 0) ; Returns: i

Repeat
  event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
Image
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: GetGadgetItemText() doesn't work with wrapped text in EditorGadget

Post by mk-soft »

Not with me ...
PB 6.20b4

Windows and macOS: Visible Line
Linux: Text Line
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Sicro
Enthusiast
Enthusiast
Posts: 559
Joined: Wed Jun 25, 2014 5:25 pm
Location: Germany
Contact:

Re: GetGadgetItemText() doesn't work with wrapped text in EditorGadget

Post by Sicro »

I have now tested it with the various packages for Linux.
PureBasic 6.20 Beta 4 for Linux (Ubuntu 18.04 - x64) wrote: 9
item text
PureBasic 6.20 Beta 4 for Linux (Ubuntu 20.04 or 22.04 - x64) wrote: 9
item text
PureBasic 6.20 Beta 4 for Linux (Ubuntu 24.04 - x64) wrote: 9
i
All tested with gtk3 (default) in Manjaro Xfce x64.
Image
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
Post Reply