EditorGadget border thickness

Everything else that doesn't fall into one of the other PB categories.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

EditorGadget border thickness

Post by Dude »

I've just spent the last WEEK trying to work out why my EditorGadget would sometimes have a thicker border than normal when setting text in it. :( Here's what I mean:

Image

Today, I finally worked out why: if the EditorGadget is DISABLED when you set MULTILINE text in it, the border becomes thick -- and stays thick even if you enable the gadget AFTER setting the text! :shock: So the "solution" was to ENABLE the EditorGadget BEFORE setting MULTILINE text in it. Yes, the order of operations makes a difference. Who would've known?

Below is my test code that shows the problem. Is this common knowledge, or a bug?

Code: Select all

OpenWindow(0,200,200,210,100,"test",#PB_Window_SystemMenu)

EditorGadget(1,10,10,90,80)

DisableGadget(1,1)
SetGadgetText(1,"thin border")
DisableGadget(1,0)

EditorGadget(2,110,10,90,80)
a$="thick border"+#CRLF$
For a=1 To 10
  a$+Str(a)+#CRLF$
Next

DisableGadget(2,1) ; Comment this to see the difference!
SetGadgetText(2,a$)
DisableGadget(2,0)

Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 625
Joined: Mon May 09, 2011 9:36 am

Re: EditorGadget border thickness

Post by VB6_to_PBx »

if you move the Window almost completely off Screen...then back again onto Screen ,
the EditorGadget reverts back to Thin Border
 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: EditorGadget border thickness

Post by Dude »

Yep, and we could probably manually update the gadget with InvalidateRect_() too; but the problem is the order of operations. We need to enable the gadget first, and then add multiline text. Before, I was adding multiline text first and then enabling, which causes the thick border. This is the type of issue that you can't easily resolve because you think you're doing the logical things, and the underlying problem isn't obvious. And the problem never occurs with single-line text, making it even harder to work out. :x
User avatar
DK_PETER
Addict
Addict
Posts: 898
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: EditorGadget border thickness

Post by DK_PETER »

Code: Select all

Macro RedrawGadget(Gad)
  HideGadget(Gad, #True)
  HideGadget(Gad, #False)
EndMacro
Should redraw the gadget correctly with the above macro.
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: EditorGadget border thickness

Post by Dude »

Thanks DK_PETER, that fixes it. Shame it has to be done like that, though. :(
User avatar
Bisonte
Addict
Addict
Posts: 1232
Joined: Tue Oct 09, 2007 2:15 am

Re: EditorGadget border thickness

Post by Bisonte »

Another little cheat :mrgreen:

Code: Select all

ContainerGadget(4, 210, 10, 100, 80, #PB_Container_Flat)
EditorGadget(5, -1, -1, 102, 82)
CloseGadgetList()
PureBasic 6.10 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
Post Reply