Page 1 of 1

EditorGadget border thickness

Posted: Sat Mar 10, 2018 5:52 am
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

Re: EditorGadget border thickness

Posted: Sat Mar 10, 2018 7:29 am
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

Re: EditorGadget border thickness

Posted: Sat Mar 10, 2018 12:07 pm
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

Re: EditorGadget border thickness

Posted: Sat Mar 10, 2018 2:28 pm
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.

Re: EditorGadget border thickness

Posted: Sat Mar 17, 2018 8:53 am
by Dude
Thanks DK_PETER, that fixes it. Shame it has to be done like that, though. :(

Re: EditorGadget border thickness

Posted: Sat Mar 17, 2018 1:12 pm
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()