Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1480

Scintilla Source Code editor OCX for VB

$
0
0
I noticed the board didn't have much on the Scintilla source code editor so wanted to make sure a copy of this got saved.

Scintilla is a source code editor component that includes source code highlighting, code folding, line numbering, bookmarks, built in intellisense etc. It is a great control if you want to create a source code editor or debugger UI.

Name:  screenshot.jpg
Views: 162
Size:  14.5 KB

Its a free component written in C and builds as SciLexer.dll. You can download the source files here:

https://www.scintilla.org/

The source attached here, scivb2.ocx, is a vb6 control that makes using it quite easy. This is an update to Stewarts great scivb.ocx control that is part of his cEditXP souce code editor.

http://www.planet-source-code.com/vb...66207&lngWId=1

I spent some time inside of it and adapted it for what I needed so I could use it as a debugger UI You can see an example of it in action here:

https://www.youtube.com/watch?v=nSr1-OugQ1M

I have attached a copy of the ocx source. I have been using this for several years now and has proven stable. Any updates will be in the git repo below.

https://github.com/dzzie/scivb2

public methods:
Code:

'Events
Event NewLine()
Event MouseDwellEnd(lline As Long, Position As Long)
Event MouseDwellStart(lline As Long, Position As Long)
Event MarginClick(lline As Long, Position As Long, margin As Long, modifiers As Long)
Event AutoCSelection(Text As String)                        'Auto Completed selected
Event CallTipClick(Position As Long)                        'Clicked a calltip
Event UserListSelection(listType As Long, Text As String)  'Selected AutoComplete
Event LineChanged(Position As Long)
Event OnModified(Position As Long, modificationType As Long)
Event DoubleClick()
Event MouseUp(Button As Integer, Shift As Integer, x As Long, y As Long)
Event MouseDown(Button As Integer, Shift As Integer, x As Long, y As Long)
Event key(ch As Long, modifiers As Long)
Event KeyUp(KeyCode As Long, Shift As Long)
Event KeyDown(KeyCode As Long, Shift As Long)
Event DebugMsg(Msg As String)
Event KeyPress(Char As Long)
Event AutoCompleteEvent(className As String)

'Properties
Property FoldComment() As Boolean
Property FoldAtElse() As Boolean
Property FoldMarker() As FoldingStyle
Property Folding() As Boolean    'If true folding will be automatically handled.
Property DisplayCallTips() As Boolean  'If this is set to true then calltips will be displayed.  To use this you must also use <B>LoadAPIFile</b> to load an external API file which contains simple instructions to the editor on what calltips to display.
Property SelFore() As OLE_COLOR  'The allows you to control the fore color of the selected color.
Property SelBack() As OLE_COLOR  'This allow's you to set the backcolor for selected text.
Property WordWrap() As Boolean 'If set to true the document will wrap lines which are longer than itself.  If false then it will dsiplay normally.
Property ShowFlags() As Boolean  'If this is true the second gutter will be displayed and Flags/Bookmarks will be displayed.
Property isDirty() As Boolean  'This is a read only property.  It allows you to get the modified status of the Scintilla window.
Property ReadOnly() As Boolean  'This property allows you to set the readonly status of Scintilla.  When in readonly you can scroll the document, but no editing can be done.
Property LineNumbers() As Boolean    'If this is set to true then the first gutter will be visible and display line numbers.  If this is false then the first gutter will remain hidden.
Property ContextMenu() As Boolean    'If set to true then the default Scintilla context menu will be displayed when a user right clicks on the window.  If this is set to false then no context menu will be displayed.  If you are utilizing a customer context menu then this should be set to false.
Property AutoCompleteString() As String  'This store's the list which autocomplete will use.  Each word needs to be seperated by a space.
Property IndentWidth() As Long  'This controls the number of spaces Tab will indent.  IndentWidth only applies if <B>TabIndents</b> is set to false.
Property BackSpaceUnIndents() As Boolean 'If tabindents is set to false, and BackSpaceUnIndents is set to true then the backspaceunindents will remove the same number of spaces as tab inserts.  If it's set to false then it will work normally.
Property UseTabIndents() As Boolean 'If this is true tab inserts indent characters.  If it is set to false tab will insert spaces.
Property useTabs() As Boolean
Property ShowIndentationGuide() As Boolean  'If true indention guide's will be displayed.
Property MaintainIndentation() As Boolean 'If this is set to true the editor will automatically keep the previous line's indentation.
Property HighLightActiveLine() As Boolean    'When set to true the active line will be highlighted using the color selected from LineBackColor.
Property ActiveLineBackColor() As OLE_COLOR    'Allows you to control the backcolor of the active line.
Property SelText() As String 'Allows you to get and set the seltext of the scintilla window.
Property Text() As String    'Allows you to get and set the text of the scintilla window.
Property SelLength() As Long
Property SelEnd() As Long
Property SelStart() As Long
Property codePage() As SC_CODETYPE
Property TotalLines() As Long
Property VisibleLines() As Long
Property FirstVisibleLine() As Long
Property AutoCloseQuotes() As Boolean    'When set to true quotes will automatically be closed.
Property AutoCloseBraces() As Boolean    'When this is set to true braces <B>{, [, (</b> will be closed automatically.
Property Version() As String
Property currentHighlighter() As String
Property sciHWND() As Long
Friend Property Let ReplaceFormActive(x As Boolean)

'Methods
Function isMouseOverCallTip() As Boolean
Sub LockEditor(Optional locked As Boolean = True)
Function WordUnderMouse(pos As Long, Optional ignoreWhiteSpace As Boolean = False) As String
Sub ShowGoto()
Sub ShowAbout()
Function ShowFindReplace() As Object
Function FindNext(Optional wrap As Boolean = False) As Long
Function Find(sSearch As String, _
Function FindAll(sSearch As String, _
Function ReplaceAll(strSearchFor As String, _
Function ReplaceText(strSearchFor As String, _
Sub MarkAll(strFind As String)
Sub SetMarker(iLine As Long, Optional iMarkerNum As Long = 2)
Sub DeleteAllMarkers(Optional marknum As Long = 2)
Sub PrevMarker(lline As Long, Optional marknum As Long = 2)
Sub NextMarker(lline As Long, Optional marknum As Long = 2)
Sub DeleteMarker(iLine As Long, Optional marknum As Long = 2)
Sub ToggleMarker(Optional line As Long = -1)
Sub FoldAll()
Sub ShowCallTip(strVal As String)
Sub StopCallTip()
Function AddCallTip(functionPrototype As String)
Function LoadCallTips(strFile As String) As Long
Function LoadFile(strFile As String) As Boolean
Function SaveFile(strFile As String) As Boolean
Function PreviousWord() As String
Function CurrentWord() As String
Sub ShowAutoComplete(strVal As String)
Function GetCaretInLine() As Long
Function CurrentLine() As Long
Sub SetCurrentPosition(lval As Long)
Function PositionFromLine(lline As Long) As Long
Sub ClearUndoBuffer()
Function SelectLine() As Long
Function SelectAll() As Long
Function Paste() As Long
Function Copy() As Long
Function Cut() As Long
Function Undo() As Long
Function Redo() As Long
Function SetFocus() As Long
Function GotoCol(Column As Long) As Long
Sub GotoLineColumn(iLine As Long, iCol As Long)
Function GotoLine(line As Long) As Long
Function GetLineText(ByVal lline As Long) As String
Function FileExists(strFile As String) As Boolean
Function FolderExists(path) As Boolean
Sub GotoLineCentered(ByVal line As Long, Optional selected As Boolean = True)
Function hilightWord(sSearch As String, Optional color As Long = 0, Optional compare As VbCompareMethod = vbTextCompare) As Long
Sub hilightClear()
Sub UncommentBlock()
Sub CommentBlock()
Function ExportToHTML(filePath As String) As Boolean
Function LoadHighlightersDir(dirPath As String) As Long
Function HighlighterForExtension(fPath As String) As String
Function LoadHighlighter(filePath As String, Optional andSetActive As Boolean = True) As Boolean
Function SetHighlighter(langName As String) As Boolean

Attached Images
 
Attached Files

Viewing all articles
Browse latest Browse all 1480

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>