Date: 02-16-2022
Return to Index
created by gbSnippets
'This is a reduced-code example of Example 25,
'containing only the minimal lines needed to
'display content within 2 different Scintilla controls.
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32api.inc"
#Include "scintilla_gb.inc"
%IDC_Left = 500 : %IDC_Right = 501 : %IDC_Bottom = 502
%IDC_LabelH = 503 : %IDC_LabelV = 504
Global hDlg, hLib, hRight, hBottom, pDoc As Dword
Function PBMain()
hLib = LoadLibrary("SCILEXER.DLL")
Dialog New Pixels, 0, "Split Screen Example",300,300,220,440, %WS_OverlappedWindow Or %WS_ClipChildren To hDlg
Dialog Set Icon hDlg, "aainfo"
Control Add "Scintilla", hDlg, %IDC_Right, "", 10, 10, 200, 200, %WS_Child Or %WS_Visible Or %WS_Border
Control Handle hDlg, %IDC_Right To hRight 'get handle to Scintilla window
Control Add "Scintilla", hDlg, %IDC_Bottom, "", 10, 220, 200, 200, %WS_Child Or %WS_Visible Or %WS_Border
Control Handle hDlg, %IDC_Bottom To hBottom 'get handle to Scintilla window
Dialog Show Modal hDlg Call DlgProc()
End Function
'monitor mouse movement=================================
CallBack Function DlgProc() As Long
Select Case Cb.Msg
Case %WM_InitDialog : InitializeScintilla : PostMessage hRight, %SCI_SetSel, 0,0 'unselect initially
Case %WM_Destroy : FreeLibrary hLib 'free the Scintilla library
End Select
End Function
Sub InitializeScintilla
Local txt As String, i As Long
For i = 0 To 100 : txt = txt + "Line " + Str$(i) + $CrLf : Next i
txt = Trim$(txt, Chr$(0)) + Chr$(0)
SendMessage hRight, %SCI_SetText, 0, StrPtr(txt)
SendMessage hRight, %SCI_SetMarginWidthN, 0, 20
SendMessage hBottom, %SCI_SetMarginWidthN, 0, 20
pDoc = SendMessage(hRight, %SCI_GetDocPointer, 0, 0)
SendMessage(hBottom, %SCI_SetDocPointer, 0, pDoc)
End Sub
'gbs_00691
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm