Page 1 of 1

Bug? SetGadgetText on EditorGadget

Posted: Sun Mar 04, 2018 11:59 pm
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

Re: Bug? SetGadgetText on EditorGadget

Posted: Mon Mar 05, 2018 12:03 pm
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

Re: Bug? SetGadgetText on EditorGadget

Posted: Mon Mar 05, 2018 1:27 pm
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 ??

Re: Bug? SetGadgetText on EditorGadget

Posted: Mon Mar 05, 2018 1:36 pm
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...

Re: Bug? SetGadgetText on EditorGadget

Posted: Mon Mar 05, 2018 1:42 pm
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

Re: Bug? SetGadgetText on EditorGadget

Posted: Mon Mar 05, 2018 1:44 pm
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

Re: Bug? SetGadgetText on EditorGadget

Posted: Mon Mar 05, 2018 1:57 pm
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$

Re: Bug? SetGadgetText on EditorGadget

Posted: Mon Mar 05, 2018 2:13 pm
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!