Change colour or remove Scintilla Gadget Border

Windows specific forum
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Change colour or remove Scintilla Gadget Border

Post by IdeasVacuum »

Anyone know how to change the colour of or remove the Scintilla Gadget Border (World's ugliest ever border :mrgreen: )

Edit: I have slightly oversized it and set X and Y negative - looks much better.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
kenmo
Addict
Addict
Posts: 1967
Joined: Tue Dec 23, 2003 3:54 am

Re: Change colour or remove Scintilla Gadget Border

Post 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
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Change colour or remove Scintilla Gadget Border

Post 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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
kenmo
Addict
Addict
Posts: 1967
Joined: Tue Dec 23, 2003 3:54 am

Re: Change colour or remove Scintilla Gadget Border

Post 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)
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4662
Joined: Sun Apr 12, 2009 6:27 am

Re: Change colour or remove Scintilla Gadget Border

Post 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
Egypt my love
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Change colour or remove Scintilla Gadget Border

Post by IdeasVacuum »

Hi Kenmo

50-50 chance...... yes, the correct one works perfectly :mrgreen:

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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply