Page 1 of 1
Change colour or remove Scintilla Gadget Border
Posted: Wed May 06, 2020 12:50 pm
by IdeasVacuum
Anyone know how to change the colour of or remove the Scintilla Gadget Border (World's ugliest ever border

)
Edit: I have slightly oversized it and set X and Y negative - looks much better.
Re: Change colour or remove Scintilla Gadget Border
Posted: Wed May 06, 2020 1:38 pm
by kenmo
Code: Select all
Procedure Sci_SetBorder_(Gadget.i, State.i)
CompilerIf (#PB_Compiler_OS = #PB_OS_Windows)
If (State)
SetWindowLongPtr_(GadgetID(Gadget), #GWL_EXSTYLE, GetWindowLongPtr_(GadgetID(Gadget), #GWL_EXSTYLE) | #WS_EX_CLIENTEDGE)
Else
SetWindowLongPtr_(GadgetID(Gadget), #GWL_EXSTYLE, GetWindowLongPtr_(GadgetID(Gadget), #GWL_EXSTYLE) & ~#WS_EX_CLIENTEDGE)
EndIf
CompilerEndIf
EndProcedure
Re: Change colour or remove Scintilla Gadget Border
Posted: Wed May 06, 2020 1:56 pm
by IdeasVacuum
That's interesting Kenmo - what is the "state" var for?
Since I'm Windows only, I just added this after the gadget definition:
Code: Select all
SetWindowLongPtr_(GadgetID(#Scnt), #GWL_EXSTYLE, GetWindowLongPtr_(GadgetID(#Scnt), #GWL_EXSTYLE) | #WS_EX_CLIENTEDGE)
[/size]
..... but it has no effect? Windows 7 x64.
Re: Change colour or remove Scintilla Gadget Border
Posted: Wed May 06, 2020 10:23 pm
by kenmo
Maybe "State" should be called "Enable" to be more clear
Call the procedure with State = #False to remove the default border.
So you picked the wrong line of the 2 to copy, try:
Code: Select all
SetWindowLongPtr_(GadgetID(#Scnt), #GWL_EXSTYLE, GetWindowLongPtr_(GadgetID(#Scnt), #GWL_EXSTYLE) & ~#WS_EX_CLIENTEDGE)
Re: Change colour or remove Scintilla Gadget Border
Posted: Wed May 06, 2020 11:59 pm
by RASHAD
Hi IV
How about the very famous method
Should be cross platform as well
And variety of Borders too
Code: Select all
If OpenWindow(0, 0, 0, 330, 90, "ScintillaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If InitScintilla()
ContainerGadget(10,10,10,310, 70,#PB_Container_Flat)
ScintillaGadget(0, -2, -2, 310, 70, 0)
CloseGadgetList()
; Output set to red color
ScintillaSendMessage(0, #SCI_STYLESETFORE, 0, RGB(255, 0, 0))
; Set the initial text to the ScintillaGadget
*Text=UTF8("This is a simple ScintillaGadget with text...")
ScintillaSendMessage(0, #SCI_SETTEXT, 0, *Text)
FreeMemory(*Text) ; The buffer made by UTF8() has to be freed, to avoid memory leak
; Adding a second line of text with linebreak before
Text$ = Chr(10) + "Second line"
*Text=UTF8(Text$)
ScintillaSendMessage(0, #SCI_APPENDTEXT, Len(Text$), *Text)
FreeMemory(*Text)
EndIf
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Re: Change colour or remove Scintilla Gadget Border
Posted: Thu May 07, 2020 1:42 am
by IdeasVacuum
Hi Kenmo
50-50 chance...... yes, the correct one works perfectly
Hi Rashad
I actually already used that method. It gets tricky when a scrollbar auto-displays, so on this occasion the API solution is best.