Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Debug Error On 'catch array/pointer errors - OFF in production
#Debug Display On 'display untrapped errors - OFF in production
#Include "Win32API.inc"
#Include "scintilla_gb.inc"
%ID_Sci = 1000
Global hDlg, hSci, hLib As DWord
Function PBMain() As Long
hLib = LoadLibrary("SCILEXER.DLL")
Dialog New Pixels, 0, "Scintilla: DLL Lexer",300,300,200,150, %WS_OverlappedWindow To hDlg
Control Add "Scintilla", hDlg, %ID_Sci, "", 10,10,180,130, %WS_Child Or %WS_Visible
Control Handle hDlg, %ID_Sci To hSci 'get handle to Scintilla window
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Select Case CB.Msg
Case %WM_InitDialog
InitializeSci
Case %WM_Size
Control Set Size hDlg, %ID_Sci, Lo(Word, CB.lParam)-110, Hi(Word, CB.lParam)-20
Case %WM_Destroy
If hLib Then FreeLibrary hLib ' Free the Scintilla library
End Select
End Function
Sub InitializeSci
Local txt As String
txt = "Select Case" + $CrLf
txt = txt + "' Case " + Chr$(34) + "cat" + Chr$(34) + $CrLf
txt = txt + "' Case " + Chr$(34) + "dog" + Chr$(34) + $CrLf
txt = txt + "End Select" + Chr$(0)
SendMessage(hSci, %SCI_SetText, 0, StrPTR(txt)) 'set example text
SendMessage hSci, %SCI_SetMarginWidthN, 0, 20 'display line numbers
txt = "CustomPowerBASICLexer.dll"
SendMessage hSci, %SCI_LoadLexerLibrary, 0, StrPTR(txt)
txt = "custompowerbasic"
SendMessage hSci, %SCI_SetLexerLanguage, 0, StrPTR(txt)
txt = String$(100," ")
SendMessage hSci, %SCI_GetLexerLanguage, 0, StrPTR(txt)
MsgBox txt
End Sub
'gbs_00667
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm