Bug? SetGadgetText on EditorGadget

Just starting out? Need help? Post your questions and find answers here.
User avatar
kenmo
Addict
Addict
Posts: 2047
Joined: Tue Dec 23, 2003 3:54 am

Bug? SetGadgetText on EditorGadget

Post by kenmo »

Windows 7, PB 5.62 x86

On an EditorGadget, SetGadgetText(0, #CRLF$) inserts a newline instead of replacing all the text with a newline.

Bug?

Code: Select all

OpenWindow(0, 0, 0, 320, 240, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
EditorGadget(0, 0, 0, 320, 240)

SetGadgetText(0, "First text!")
SetGadgetText(0, "Hello" + #CRLF$ + "World!") ; overwrites previous text
SetGadgetText(0, #CRLF$) ; does not overwrite previous text !!!

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
said
Enthusiast
Enthusiast
Posts: 342
Joined: Thu Apr 14, 2011 6:07 pm

Re: Bug? SetGadgetText on EditorGadget

Post by said »

I can confirm the same behavior here :!: (Win 10 PB5.62) a newline is being inserted on top
Looks like a bug to me
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 627
Joined: Mon May 09, 2011 9:36 am

Re: Bug? SetGadgetText on EditorGadget

Post by VB6_to_PBx »

i have a bunch of inputs in a program
and each input has Help text

i use only 1 EditorGadget to display Help text for a large program
and i clear out the EditorGadget each time as i travel thru the inputs with this

ClearGadgetItems(0)
then another SetGadgetText(0, Txt$) for the next Input's help text
then another
ClearGadgetItems(0) and so on

Code: Select all

OpenWindow(0, 0, 0, 320, 240, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
EditorGadget(0, 0, 0, 320, 240)

Txt$ = "First text!" + #CRLF$ + "Hello" + #CRLF$ + "World!"
SetGadgetText(0, Txt$)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow

i'm guessing this is what you meant ??
 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison
User avatar
Bisonte
Addict
Addict
Posts: 1313
Joined: Tue Oct 09, 2007 2:15 am

Re: Bug? SetGadgetText on EditorGadget

Post by Bisonte »

VB6_to_PBx wrote:i'm guessing this is what you meant ??
No. The Help says, that SetGadgetText() change the COMPLETE content of the EditorGadget.

So SetGadgetText(EditorGadget, #CRLF$) should clear the EditorGadget and set a blank first line...
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 627
Joined: Mon May 09, 2011 9:36 am

Re: Bug? SetGadgetText on EditorGadget

Post by VB6_to_PBx »

Bisonte wrote:
VB6_to_PBx wrote:i'm guessing this is what you meant ??
No. The Help says, that SetGadgetText() change the COMPLETE content of the EditorGadget.

So SetGadgetText(EditorGadget, #CRLF$) should clear the EditorGadget and set a blank first line...
SetGadgetText()
i tried that a few years ago it didn't work with previous versions , so i used ClearGadgetItems(0) instead
 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4954
Joined: Sun Apr 12, 2009 6:27 am

Re: Bug? SetGadgetText on EditorGadget

Post by RASHAD »

#CR$ & #LF$ works fine but not #CRLF$
But these are control characters not text if you want to consider this as a bug you have the right to do that
Egypt my love
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 627
Joined: Mon May 09, 2011 9:36 am

Re: Bug? SetGadgetText on EditorGadget

Post by VB6_to_PBx »

RASHAD wrote:#CR$ & #LF$ works fine but not #CRLF$
But these are control characters not text if you want to consider this as a bug you have the right to do that
thanks RASHAD , that worked

i was so use to using VB6.0 's vbCRLF i went naturally to PB's #CRLF$
 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison
User avatar
kenmo
Addict
Addict
Posts: 2047
Joined: Tue Dec 23, 2003 3:54 am

Re: Bug? SetGadgetText on EditorGadget

Post by kenmo »

I think it is a bug.

I added SetGadgetText(0, "") before it to clear existing text.

This might seem minor, but it showed up in my program... I couldn't figure out why "old" text was showing up in my output gadget!
Post Reply