Very difficult for me this SCINTILLA lib, since 2 days i turn around
I have see it's impossible with Scintilla to simply select a part of text and send a color or a style to it
Apparently we must passing by the predefined STYLE
Like i don't whant to define in advance numerous styles, i say to me perhaps it's possible to change a STYLE already defined on the fly
So, in the code below , I tried to use the same style twice for two completely different configurations
But apparently, it's not possible too. Only the last STYLE is using
We would therefore have no other solution than creating a style for each case :
Black+Bold+Italic // Black+Bold+normal // Red + Bold +Italic //red + Bold + normal // Green + Bold +Italic //Green + Bold + normal..etc ...
This will make hundreds of differents cases of predefined STYLE to send to Scintilla
Code: Select all
InitScintilla("Scintilla.dll")
OpenWindow(0, 0, 0, 500, 300, "Essais Scintilla", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_ScreenCentered)
ScintillaGadget(1, 0, 0, WindowWidth(0), WindowHeight(0) - 30, 0)
ScintillaSendMessage(1, #SCI_STYLESETFONT, #STYLE_DEFAULT, @"Courrier")
ScintillaSendMessage(1, #SCI_STYLESETSIZE, #STYLE_DEFAULT, 15)
ScintillaSendMessage(1, #SCI_STYLECLEARALL)
For i = 1 To 300
Ascii = Random(125, 32)
If Sentence = 40
Text$ + #CRLF$
Sentence = 0
Else
Sentence + 1
EndIf
Text$ + Chr(Ascii)
Next
ScintillaSendMessage(1, #SCI_SETTEXT, 0, UTF8(Text$))
For i = 1 To 300
Count + 1
If Count = 40
Count = 0
Select Color
Case 0
ScintillaSendMessage(1, #SCI_STYLESETITALIC, 1, #True)
ScintillaSendMessage(1, #SCI_STYLESETFORE, 1, #Red)
ScintillaSendMessage(1, #SCI_STYLESETBOLD, 1, #True)
ScintillaSendMessage(1, #SCI_STARTSTYLING, i, 1)
ScintillaSendMessage(1, #SCI_SETSTYLING, 10, 1)
Color + 1
Case 1
ScintillaSendMessage(1, #SCI_STYLESETITALIC, 1, #False)
ScintillaSendMessage(1, #SCI_STYLESETFORE, 1, #Blue)
ScintillaSendMessage(1, #SCI_STYLESETBOLD, 1, #False)
ScintillaSendMessage(1, #SCI_STARTSTYLING, i, 1)
ScintillaSendMessage(1, #SCI_SETSTYLING, 20, 1)
Color + 1
EndSelect
EndIf
Next
Repeat
Evenement = WaitWindowEvent()
Until Evenement = #PB_Event_CloseWindow







