Date: 02-16-2022
Return to Index
created by gbSnippets
'Placing the Scintilla control in a PowerBASIC application requires only a few lines
'of code. This snippet demonstrates the minimal code needed to add Scintilla to a
'PowerBASIC application.
'Note that this snippet requires the use of my "scintilla_gb.inc" include file,
'which declares various Scintilla-specific constants and functions.
'The two basic steps are to load the Scintilla DLL into memory and then add the
'control to your PowerBASIC dialog using the CONTROL ADD statement.
'Primary Code:
'To load the Scintilla DLL, use the Windows LoadLibrary API
hLib = LoadLibrary("SCILEXER.DLL")
'Then, use the PowerBASIC CONTROL ADD statement to add a custom control using the
'class name "Scintilla"
Control Add "Scintilla", hDlg, %ID_Sci, "", 10,10,280,380, %WS_Child Or %WS_Visible
'Note the need to use the style %WS_Child OR %WS_Visible in the Control Add statement.
'Compilable Example: (Jose Includes)
'This example simply creates an application with only a Scintilla control. The control
'is fully functional, but most of its features are not demonstrated with this snippet.
'The context menu (cut/copy/paste/...) is available.
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#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, "Test Code",300,300,300,400, %WS_OverlappedWindow To hDlg
Control Add "Scintilla", hDlg, %ID_Sci, "", 10,10,280,380, %WS_Child Or %WS_Visible
Control Handle hDlg, %ID_Sci To hSci 'get handle to Scintilla window
Dialog Show Modal hDlg
End Function
'gbs_00626
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm