scintilla 1.71
Exportet Functions:
ScintillaGadget(id,x,y,cx,cy[,flags]); the last parameter for windowsstyle
Scintilla_DirectFunction(*sci, Message, wParam, lParam)
*sci is stored in GadgetData of the control, better use the includefile "SciLexer.pbi" or the residentfile "SciLexer.res"
This UserLib doesn't require a dll (written in c++)
Download
Scintilla Userlib PB4
Scintilla Userlib PB4
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

here an examples, uses SyntaxHilighting.dll from the PB-SDK
example here: http://ts-soft.eu/dl/pb_syntaxhighlight.exe
Code: Select all
; requires:
; Scintilla UserLib http://www.purebasic.fr/english/viewtopic.php?t=24210
; SyntaxHilighting.dll + SyntaxHilighting.lib from PureBasic SDK
XIncludeFile "SciLexer.pbi"
EnableExplicit
Enumeration
#SYNTAX_Text
#SYNTAX_Keyword
#SYNTAX_Comment
#SYNTAX_Constant
#SYNTAX_String
#SYNTAX_Function
#SYNTAX_Asm
#SYNTAX_Operator
#SYNTAX_Structure
#SYNTAX_Number
#SYNTAX_Pointer
#SYNTAX_Separator
#SYNTAX_Label
EndEnumeration
Import "SyntaxHilighting.lib"
SyntaxHighlight( *Buffer, len, callback, asm)
EndImport
#SciID = 0
Procedure SHCallback(pos, len, id)
Shared start_pos,Buffer
SCI_StartStyling(#SciID, (pos - Buffer) + start_pos, $1F)
SCI_SetStyling(#SciID, len, id)
EndProcedure
Procedure WindowCallback(hwnd, uMsg, wParam, lParam)
Protected *p_notify.SCNotification
Protected line_number.l
Protected txtr.TEXTRANGE
Shared start_pos.l, end_pos.l, Buffer.l
If uMsg = #WM_NOTIFY
*p_notify = lParam
If *p_notify\nmhdr\code = #SCN_STYLENEEDED
line_number = SCI_LineFromPosition(#SciID, SCI_GetEndStyled(#SciID))
start_pos = SCI_PositionFromLine(#SciID, line_number)
end_pos = *p_notify\Position
txtr\chrg\cpMin = start_pos
txtr\chrg\cpMax = end_pos
txtr\lpstrText = AllocateMemory(end_pos - start_pos + 1)
Buffer = txtr\lpstrText
SCI_GetTextRange(#SciID, txtr)
SyntaxHighlight(Buffer, end_pos - start_pos, @SHCallback(), #False)
FreeMemory(Buffer)
EndIf
EndIf
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
If OpenWindow(0, #PB_Ignore, 0, 800, 600, "Test")
CreateGadgetList(WindowID(0))
ScintillaGadget(#SciID, 0, 0, 800, 600)
SetWindowCallback(@WindowCallback())
Else
End
EndIf
SCI_SetLexer(#SciID, #SCLEX_CONTAINER)
SCI_StyleSetFore(#SciID, #STYLE_DEFAULT, $000000)
SCI_StyleSetBack(#SciID, #STYLE_DEFAULT, $FFFFFF)
SCI_StyleSetFont(#SciID, #STYLE_DEFAULT, @"Courier New")
SCI_StyleSetSize(#SciID, #STYLE_DEFAULT, 10)
SCI_StyleClearAll(#SciID)
SCI_StyleSetFore(#SciID, #SYNTAX_Text, $000000)
SCI_StyleSetFore(#SciID, #SYNTAX_Keyword, $9D030D)
SCI_StyleSetBold(#SciID, #SYNTAX_Keyword, #True)
SCI_StyleSetFore(#SciID, #SYNTAX_Comment, $6F884A)
SCI_StyleSetFore(#SciID, #SYNTAX_Constant, $0B46AE)
SCI_StyleSetFore(#SciID, #SYNTAX_String, $413C33)
SCI_StyleSetItalic(#SciID, #SYNTAX_String, #True)
SCI_StyleSetFore(#SciID, #SYNTAX_Function, $EF303D)
SCI_StyleSetFore(#SciID, #SYNTAX_Asm, $400080)
SCI_StyleSetFore(#SciID, #SYNTAX_Operator, $0000FF)
SCI_StyleSetFore(#SciID, #SYNTAX_Structure, $0548B4)
SCI_StyleSetFore(#SciID, #SYNTAX_Number, $0000FF)
SCI_StyleSetFore(#SciID, #SYNTAX_Pointer, $0507B4)
SCI_StyleSetFore(#SciID, #SYNTAX_Separator, $000000)
SCI_StyleSetFore(#SciID, #SYNTAX_Label, $804000)
SCI_SetMarginTypen(#SciID, 0, #SC_MARGIN_NUMBER)
SCI_SetMarginWidthN(#SciID, 0, 30)
While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Guide for dummies
Hi everyone,I was Just wondering if there is a guide on how to use this lib and its functions.
Such as how to use it to highlight a word or words that I choose,as I wish to make an editor using it to highlight some commands,and fold sections of text using the keyword `Fold`,how do you go about creating an editor gadet that will do this.
I have never used anything like this,so as simple as possible.
Thanks very much.
Such as how to use it to highlight a word or words that I choose,as I wish to make an editor using it to highlight some commands,and fold sections of text using the keyword `Fold`,how do you go about creating an editor gadet that will do this.
I have never used anything like this,so as simple as possible.
Thanks very much.
They Say You Never Stop Learning,Well I Can`t Seem To Start. 
