Results 1 to 23 of 23

Thread: Scintilla Source Code editor OCX for VB

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,068

    Scintilla Source Code editor OCX for VB

    For those of you aware Scintilla is a source editing
    component written in C++ and wrapped in the form of a DLL. It
    is available freely from:
    http://www.scintilla.org

    This project further wraps the C++ dll into an easy to use ActiveX OCX
    control for use in VB6. Original author was Stewart and was part of his
    cEditMX code editor.
    http://www.Planet-Source-Code.com/vb...66207&lngWId=1

    Features:
    - syntax highlighting
    - code completion
    - code folding
    - intellisense
    - advanced editor features
    - debugger support such as breakpoints and current line highlighting

    I have spent several months full time working on it to get it where
    I needed it for several projects and it is an important enough
    component that i wanted to make sure it remained available to everyone.

    Source: http://sandsprite.com/openSource.php?id=96
    Last edited by dz32; Jul 26th, 2023 at 06:07 PM.

  2. #2
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: Scintilla Source Code editor OCX for VB

    In case anyone is wondering, this is the editing component used in NotePad++.

  3. #3
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    678

    Re: Scintilla Source Code editor OCX for VB

    It is very good to use

  4. #4
    Junior Member
    Join Date
    Oct 2017
    Posts
    19

    Re: Scintilla Source Code editor OCX for VB

    Whoa!!!

    This looks amazing! I am playing a little with it and works really nice

    I am just struggling a little to find out how to set a different lexer than the javaScript one. In particular I am trying to set up a VBScript lexer. Can this be done with a simple command (SetLexer, ...) or you have to set it up?

    If you have any little tuto or link to find this out it will be really appreciated!

    Thanks a lot!!

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,068

    Re: Scintilla Source Code editor OCX for VB

    [...]
    Last edited by dz32; Apr 26th, 2019 at 11:15 AM.

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,068

    Re: Scintilla Source Code editor OCX for VB

    [...]
    Last edited by dz32; Apr 26th, 2019 at 11:15 AM.

  7. #7
    Junior Member
    Join Date
    Oct 2017
    Posts
    19

    Re: Scintilla Source Code editor OCX for VB

    It may be not the best place to put this comment but I just found in the net your Active Script Interface class. Once again thanks a lot dz32 for these codes.

    A little question, is there anywhere available some tutorial to build these interfaces you made to the ActiveScript and Scindilla project?

    Many many thanks again for all your codes

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,068

    Re: Scintilla Source Code editor OCX for VB

    [...]
    Last edited by dz32; Apr 26th, 2019 at 11:15 AM.

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,068

    Re: Scintilla Source Code editor OCX for VB

    [...]
    Last edited by dz32; Apr 26th, 2019 at 11:15 AM.

  10. #10
    Junior Member Flauzer's Avatar
    Join Date
    Mar 2022
    Location
    c:\windows\system32
    Posts
    18

    Re: Scintilla Source Code editor OCX for VB

    although OCX is partial...scivb2 it's an excellent and impressive work. really.
    There is someone who has integrated keywords, methods (with parameters) in the intellisense by directly reading an ax.dll and exploiting the information from the tLbinf32.dll (Interfaces, members, ...) ??

  11. #11

  12. #12
    Junior Member Flauzer's Avatar
    Join Date
    Mar 2022
    Location
    c:\windows\system32
    Posts
    18

    Re: Scintilla Source Code editor OCX for VB

    many thx

  13. #13

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,068

    Re: Scintilla Source Code editor OCX for VB

    I never got around to integrating an activex tlb parser with it. All of my projects just use hard coded lists.

    Scintinilla really offers a ton of features. There has been at least 5 authors in the kitchen cooking on just the VB side, plus Neil and all the contributors on the C side.

    When I went through the ocx I broke out what I really needed, and didnt want to get swamped in the weeds. Extras were moved to the DirectSci class. Much more is possible even with the ocx by sending messages and you can also subclass the scintinilla control directly to receive more messages and do extra stuff.

    In terms of the hilighter files, The javascript/C and SQL ones seem to work well, some of the others I had problems with. More are included in the original zip in the /others folder of the repo. In more current projects I have just taken to skipping the hilighter and doing it manually (see code below)

    I dont really have help files or read me on this component. Best examples are in other open source projects such as:

    - Script Basic IDE / Debugger
    - http://sandsprite.com//blogs/index.p...=310&year=2014

    - Duktape JS debugger:
    - http://sandsprite.com/tools.php?id=23

    Example manually setting lexers, keywords and colors
    Code:
    Sub SyntaxColor(Optional scm As sci_color_mode = scm_pcode, Optional additionalKeywords As String)
    
        With txtCode.DirectSCI
    
             If scm = scm_text Then
                If .GetLexer <> SCLEX_NONE Then
                    .SetLexer SCLEX_NONE
                    .ClearDocumentStyle
                    .StyleClearAll
                    .StyleSetFore STYLE_DEFAULT, vbBlack
                    .StyleSetSize STYLE_DEFAULT, 11
                    .StyleSetFont STYLE_DEFAULT, "Courier New"
                    '.StyleSetBits 5
                    .Colourise 0, -1
                End If
                
             ElseIf scm = scm_pcode Then
             
                'If .GetLexer = SCLEX_CPP Then Exit Sub
                
                .ClearDocumentStyle
                .StyleClearAll
                '.StyleSetBits 5
                .SetLexer SCLEX_CPP
                .StyleSetFore STYLE_DEFAULT, vbBlack
                .StyleSetSize STYLE_DEFAULT, 11
                .StyleSetFont STYLE_DEFAULT, "Courier New"
                
                'calls
                .SetKeyWords 0, "New ImpAdCallHresult ImpAdCallFPR4 ImpAdCallI2 ImpAdCallCy VCallHresult VCallFPR8 VCallAd ThisVCallHresult ThisVCall " & _
                                "ThisVCallAd LateIdSt ImpAdCallI4 NewIfNullRf NewIfNullAd NewIfNullPr ThisVCallUI1 ThisVCallI2 ThisVCallR4 ThisVCallR8 " & _
                                "ThisVCallCy ThisVCallHidden ThisVCallCbFrame VCallUI1 VCallStr VCallR4 VCallR8 VCallCy VCallCbFrame ImpAdCallUI1 " & _
                                "ImpAdCallR4 ImpAdCallR8 InvalidExcode ImpAdCallCbFrame LateMemCall LateMemLdVar LateMemCallLdVar LateMemSt LateMemCallSt " & _
                                "LateMemStAd LateIdCall LateIdLdVar LateIdCallLdVar LateIdSt LateIdCallSt LateIdStAd LateMemNamedCall LateMemNamedCallLdVar " & _
                                "LateMemNamedCallSt LateMemNamedStAd LateIdNamedCall LateIdNamedCallLdVar LateIdNamedCallSt VarLateMemCallLdVar VarLateMemLdRfVar VarLateMemSt " & _
                                "VarLateMemCallSt ImpAdCallNonVirt RaiseEvent ExitProcHresult ExitProc ExitProcI2 ExitProcR4 ExitProcR8 ExitProcCy ExitProcCb " & _
                                "ExitProcCbStack ExitProcCbHresult ExitProcFrameCbHresult ExitProcFrameCb ExitProcFrameCbStack End Return ExitProcUI1 ExitProcStr"
                
                'branches, equality tests, for loops
                .SetKeyWords 1, "BranchF BranchT Branch BranchFVar OnErrorGoto OnErrorResumeNext BoS BranchFVarFree BranchTVar BranchTVarFree Gosub Resume " & _
                                "OnGosub OnGoto EqI2 EqI4 EqR8 EqCy EqVar EqStr EqTextVar EqTextStr EqVarBool EqTextVarBool EqCyR8 NeUI1 NeI4 NeR4 NeCy NeVar " & _
                                "NeStr NeTextVar NeTextStr NeVarBool NeTextVarBool NeCyR8 LeUI1 LeI2 LeI4 LeR4 LeCy LeVar LeStr LeTextVar LeTextStr LeVarBool " & _
                                "LeTextVarBool LeCyR8 GeUI1 GeI2 GeI4 GeR4 GeCy GeVar GeStr GeTextVar GeTextStr GeVarBool GeTextVarBool GeCyR8 LtUI1 LtI2 LtI4 " & _
                                "LtR4 LtCy LtVar LtStr LtTextVar LtTextStr LtVarBool LtTextVarBool LtCyR8 GtUI1 GtI2 GtI4 GtR4 GtCy GtVar GtStr GtTextVar GtTextStr " & _
                                "GtVarBool GtTextVarBool GtCyR8 LikeVar LikeStr LikeTextVar LikeTextStr LikeVarBool LikeTextVarBool BetweenUI1 BetweenI2 BetweenI4 " & _
                                "BetweenR4 BetweenCy BetweenVar BetweenStr BetweenTextVar BetweenTextStr EqR4 NeI2 NeR8 LtR8 LeR8 GeR8 " & _
                                "ForUI1 ForI2 ForI4 ForR4 ForR8 ForCy ForVar ForStepUI1 ForStepI2 ForStepI4 ForStepR4 ForStepR8 ForStepCy ForStepVar ForEachCollVar " & _
                                "NextEachCollVar ForEachCollAd NextEachCollAd ForEachAryVar NextEachAryVar NextUI1 NextI2 NextI4 NextStepR4 NextR8 NextStepCy " & _
                                "NextStepVar InvalidExcode NextStepUI1 NextStepI2 NextStepI4 ForEachCollObj ForEachVar ForEachVarFree NextEachCollObj NextEachVar " & _
                                "NextStepR8 ExitForCollObj ExitForAryVar ExitForVar"
                
                If Len(additionalKeywords) = 0 Then additionalKeywords = "ModI2 ModI4 NotI4 AndI4 OrI4 XorI4 XorVar OrI2 OrVar AndUI1 AndVar ModUI1 ModVar NotUI1 " & _
                                "SeekFile NameFile OpenFile LockFile PrintFile WriteFile InputFile Input InputDone InputItemUI1 InputItemI2 InputItemI4 InputItemR4 " & _
                                "InputItemR8 InputItemCy InputItemVar InputItemStr InputItemBool InputItemDate LineInputVar LineInputStr WriteChan Close CloseAll " & _
                                "GetRec3 GetRec4 PutRec3 PutRec4 GetRecOwner3 GetRecOwner4 PutRecOwner3 PutRecOwner4"
                                
                'common crypto math, file access
                .SetKeyWords 3, additionalKeywords
                
                '.StyleSetFore SCE_C_NUMBER, &H808000
                '.StyleSetFore SCE_C_IDENTIFIER, &H808000
                
                .StyleSetFore SCE_C_COMMENT, &H8000
                .StyleSetFore SCE_C_COMMENTLINE, &H8000
                .StyleSetFore SCE_C_WORD, &H800000
                .StyleSetFore SCE_C_WORD2, vbRed
                .StyleSetFore SCE_C_GLOBALCLASS, &H25208D '808000  'keywords3
                .StyleSetFore SCE_C_STRING, &H800080
                .StyleSetFore SCE_C_CHARACTER, &H800080
                
                .StyleSetBold SCE_C_WORD, True
                .StyleSetBold SCE_C_WORD2, True
                .StyleSetBold SCE_C_GLOBALCLASS, True
                '.StyleSetBack SCE_C_GLOBALCLASS, vbYellow
                 
                .Colourise 0, -1
              
              ElseIf scm = scm_vbfrm Then
              
                .SetLexer SCLEX_VB
                .SetKeyWords 0, "object begin beginproperty endproperty end" 'must be lowercase
                '.SetKeyWords 1, "begin"
                '.SetKeyWords 2, "beginproperty"
                '.SetKeyWords 3, "endproperty end"
                '.SetKeyWords 4, "end"
                
                setVB SCE_B_COMMENT, &H5500
                setVB SCE_B_CONSTANT, vbRed
                setVB SCE_B_HEXNUMBER, vbGreen
                setVB SCE_B_IDENTIFIER, &HA00000 'dark blue
                setVB SCE_B_KEYWORD, vbRed, , , , True
                'setVB SCE_B_KEYWORD2, vbMagenta
                'setVB SCE_B_KEYWORD3, vbYellow
                'setVB SCE_B_KEYWORD4, vbCyan
                setVB SCE_B_STRING, &HC00090
                setVB SCE_B_LABEL, &HFF00FF 'magenta
                    
                .Colourise 0, -1
             
              ElseIf scm = scm_vbsrc Then
              
                'If .GetLexer = SCLEX_VB Then Exit Sub 'used in two ways...can not cache
                
                .SetLexer SCLEX_VB
                'keywords must be lowercase
                .SetKeyWords 0, "and begin case call class continue do each else elseif end erase error event exit false for function get gosub goto if implement in load loop lset me mid new next not nothing on or property raiseevent rem resume return rset select set stop sub then to true unload until wend while with withevents attribute alias as boolean byref byte byval const compare currency date declare dim double enum explicit friend global integer let lib long module object option optional preserve private public redim single static string type variant"
                setVB SCE_B_COMMENT, &H5500
                setVB SCE_B_KEYWORD, &HA00000
                setVB SCE_B_STRING, &HC00090
                    
                .Colourise 0, -1
              End If
              
    
      
      End With
    End Sub
    
    Sub setVB(i As sci_B_Indexes, _
        Optional fore As ColorConstants = vbBlack, _
        Optional back As ColorConstants = vbWhite, _
        Optional font As String = "Courier New", _
        Optional Size As Long = 11, _
        Optional bold As Boolean = False, _
        Optional italic As Boolean = False, _
        Optional underline As Boolean = False, _
        Optional visible As Boolean = True)
    
        With txtCode.DirectSCI
               .StyleSetBold i, IIf(bold, 1, 0)
               .StyleSetItalic i, IIf(italic, 1, 0)
               .StyleSetUnderline i, IIf(underline, 1, 0)
               .StyleSetVisible i, IIf(visible, 1, 0)
               .StyleSetFont i, font
               .StyleSetFore i, fore
               .StyleSetBack i, back
               .StyleSetSize i, Size
        End With
        
    End Sub
    Last edited by dz32; Feb 6th, 2024 at 07:50 PM.

  14. #14
    Junior Member Flauzer's Avatar
    Join Date
    Mar 2022
    Location
    c:\windows\system32
    Posts
    18

    Re: Scintilla Source Code editor OCX for VB

    Many thx David. I really appreciated your great job!
    at the moment I'm trying to figure out (as far as I can..) how to use "Sci_CallTipClick (Position As Long)" with the KeyUP and KeyDown keys (ie without mouse).
    Flavio

  15. #15

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,068

    Re: Scintilla Source Code editor OCX for VB

    I had only just started to play with the multiline call tip. There is a CMultiLineTip.cls class in /test/.

    I was able to get the call tips to scroll with arrow keys, I had to add another subclass the sci editor so that you could eat the arrow keypresses.

    The below code is not quite complete, you will still need to make sure to only eat the arrow key presses if the calltip window is active.

    The following two subs were added CMultiLineTip.cls
    Code:
    Public Sub NextCallTip()
        If curLine = totalLines Then Exit Sub
        curLine = curLine + 1
        sci.StopCallTip  'without this (which introduces flicker) it fails to update for some randomly
        sci.ShowCallTip curTip
    End Sub
    
    Public Sub PrevCallTip()
        If curLine = 0 Then Exit Sub
        curLine = curLine - 1
        sci.StopCallTip  'without this (which introduces flicker) it fails to update for some randomly
        sci.ShowCallTip curTip
    End Sub
    Then the below was added to a test form. The iSubclass and CSubclass were taken from the parent scivb2 code base.
    Code:
    Option Explicit
    
    Implements Project1.iSubclass
    Dim multi As New CMuiltiLineTip
    
    Private SC As cSubclass
    
    Private Sub Form_Load()
        
        Set multi.sci = sci
        
        Set SC = New cSubclass
        SC.Subclass sci.sciHWND, Me
        SC.AddMsg sci.sciHWND, WM_KEYDOWN, MSG_BEFORE
    
    End Sub
    
    Private Sub iSubclass_WndProc(ByVal bBefore As Boolean, bHandled As Boolean, lReturn As Long, ByVal lng_hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long)
        Debug.Print wParam
        'if calltipWindowActive() then  ' TODO
            If wParam = 38 Then 'uparrow 
                bHandled = True
                multi.PrevCallTip
            ElseIf wParam = 40 Then 'downarrow 
                bHandled = True
                multi.NextCallTip
            End If
        'end if 
    End Sub
     
    Private Sub Sci_AutoCompleteEvent(className As String)
               
        If className = "yy" Then
             multi.InitAndShow Array("test(xx,yy)", "test(yy)", "test(zz)", "test(kksssssssssssss)")
        End If
            
    End Sub

    seems like we can detect calltip display by hooking SCI_CALLTIPSHOW. I then tried getforegroundwindow to grab its hwnd and then monitor with a timer with iswindow() but this is failing.
    I enumerated child windows of sci and of the main window, and there was no new hwnd when the calltip was being display. it is probably just being painted onto the main sci window area.
    SCI_CALLTIPCANCEL hook does not work, not a notification message just a command message.

    scintinilla guys generally thought of everything I just dont know its guts explicitly. maybe there is a notification message for call tip closing but I havent found it yet. If you figure it out let me know and I will update the repo for everyone.
    Last edited by dz32; Mar 7th, 2022 at 10:10 AM.

  16. #16
    Junior Member Flauzer's Avatar
    Join Date
    Mar 2022
    Location
    c:\windows\system32
    Posts
    18

    Re: Scintilla Source Code editor OCX for VB

    about calltip window is active : quite difficult for me.. I was reading but without any particular other ideas ...SCI_CALLTIPACTIVE → bool
    This returns 1 if a call tip is active and 0 if it is not active.

    internal call is if (SendMessage(hwnd, SCI_CALLTIPACTIVE, 0, 0))
    so i suppose a simple call SendEditor(SCI_CALLTIPACTIVE) ...
    but as i said i have to read a lot on this topic first, i'm just taking a look.

    ... great starter for tonight , thank you once again David !!! it is not easy to enter the complex world of scintilla even trying to organize the tons of information/documentation that is found in no particular order.... I'll try to play with this valuable information.
    Last edited by Flauzer; Mar 7th, 2022 at 05:31 PM.

  17. #17
    Junior Member Flauzer's Avatar
    Join Date
    Mar 2022
    Location
    c:\windows\system32
    Posts
    18

    Re: Scintilla Source Code editor OCX for VB

    Code:
     
    is this thing wrong?
    
    If SciSimple1.IsTipActive() Then
            If wParam = 38 Then 'uparrow
                bHandled = True
                multi.PrevCallTip
            ElseIf wParam = 40 Then 'downarrow
                bHandled = True
                multi.NextCallTip
            End If
        End If
    and in the .ctl file.
    Code:
     
    Public Function IsTipActive() As Boolean
        IsTipActive = SendEditor(SCI_CALLTIPACTIVE)
    End Function

  18. #18

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,068

    Re: Scintilla Source Code editor OCX for VB

    That is working great thanks

    I will add this demo to /test subfolder.

    I can not add any new methods to the ctl in the public build because binary compatibility has already been set and I had a bunch of apps which already depend on it. But this feature can be implemented without recompiling the ocx with a subclass
    Last edited by dz32; Jul 26th, 2023 at 06:09 PM.

  19. #19
    Junior Member Flauzer's Avatar
    Join Date
    Mar 2022
    Location
    c:\windows\system32
    Posts
    18

    Re: Scintilla Source Code editor OCX for VB

    Fantastic. I have to thank you

  20. #20
    Junior Member Flauzer's Avatar
    Join Date
    Mar 2022
    Location
    c:\windows\system32
    Posts
    18

    Re: Scintilla Source Code editor OCX for VB

    HI everyone, I have just a couple of questions about scintilla...

    1)
    What I'm doing is using the scintilla + VBScript syntax, but with some "aesthetic enhancement" regarding some particular custom ActiveX and with some more keywords (always customized).
    I'm able to inject my "custom keywords" and in vbRed..., (i'm using the great wrapper scivb2.ocx dz32) but what I can't set is the bold (vbBlack) to members like this

    OBJ.Member (a, b, c)

    I can do the intellisense during typing, but the editor does not display it correctly in bold when there is a dot in the middle. Here an example with another component, that i must replace....

    Name:  sample.png
Views: 895
Size:  2.9 KB

    i've also try to insert the member with a dot befor as keyword, but the result is not so ok.....

    Name:  sample3.png
Views: 880
Size:  2.9 KB

    2)
    is it possible to have custom items in autocomplete list, ie with a dot? Here is an example

    Name:  sample2.png
Views: 891
Size:  10.1 KB



    Anyone have any suggestions or ideas?
    Thanks
    Last edited by Flauzer; Mar 12th, 2022 at 11:02 AM.

  21. #21

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,068

    Re: Scintilla Source Code editor OCX for VB

    if you add your top level objects and functions to the keywords 0 list you can get automatic bolding of them.
    you might have to fuss with it some.

    I do not know how to get full obj.method names into the autocomplete list. Doesnt seem to play well with scivb but
    its likley just how something is coded within the ocx itself. Probably something to do with the stop characters for parsing
    autocomplete strings. You will probably break a lot of stuff in scivb if you get that part to work.

    Code:
    Private Sub Form_Load()
        SyntaxColor " fso writefile readfile app caption"
    End Sub
    
    Private Sub txtCode_AutoCompleteEvent(className As String)
        
        If className = "fso" Then
            txtCode.ShowAutoComplete "writefile readfile"
        ElseIf className = "app" Then
            txtCode.ShowAutoComplete "caption"
        End If
            
    End Sub
    
    Sub SyntaxColor(Optional additionalKeywords As String)
        With txtCode.DirectSCI
                .SetLexer 3 'SCLEX_CPP
                .SetKeyWords 0, "and begin case call class continue do each else elseif end erase error event exit false for function get gosub goto if implement in load loop lset me mid new next not nothing on or property raiseevent rem resume return rset select set stop sub then to true unload until wend while with withevents attribute alias as boolean byref byte byval const compare currency date declare dim double enum explicit friend global integer let lib long module object option optional preserve private public redim single static string type variant" & additionalKeywords
                .Colourise 0, -1
        End With
    End Sub

  22. #22
    Junior Member Flauzer's Avatar
    Join Date
    Mar 2022
    Location
    c:\windows\system32
    Posts
    18

    Re: Scintilla Source Code editor OCX for VB

    thx super dz.
    i've done some experiments with Hilighter editor. Keywords area 0,1,2 are used, so I've try with 3.

    Code:
       
        With SciSimple1
            
            r = .LoadHighlighter("C:\TEMP\scivb2-master\VB.hilighter")
            
            Dim myKeyWords  As String
            
            myKeyWords = LCase("obj.method1 obj.method1 obj.method3 A.method B.method321")
            
            .DirectSCI.SetKeyWords 3, myKeyWords 'must be lowercase  ok  Keywords 3
            setVB SCE_B_KEYWORD4, vbBlack, , , 14, True    'SCE_B_KEYWORD4  ...   index +1 ?????
            
            .DirectSCI.Colourise 0, -1
    for 1) this works perfect..Thankx master

    Name:  sample4.png
Views: 895
Size:  8.1 KB
    Last edited by Flauzer; Mar 12th, 2022 at 06:31 PM.

  23. #23
    Junior Member Flauzer's Avatar
    Join Date
    Mar 2022
    Location
    c:\windows\system32
    Posts
    18

    Re: Scintilla Source Code editor OCX for VB

    Hi, coders... I'm losing my teeth looking for something readable on the fabulous "scintilla documentation", certainly not made for vb. I try to ask for some help, maybe someone has already seen something and can direct me on the right way. Sorry, but the "vb examples" are what they are, ie very simple, and as soon as something more is needed, scintilla plays "stairway to ...hell" (thanks LZ...).

    Right now I'm struggling with fixing "the layout". I managed to achieve this (my picture in attachment), but I miss the way of setting the backcolor (and fore) of the "left" margins. There seems to be 4 scintilla margins but honestly I didn't understand much ....Margin 0 is for linenumber, 2 for folding....So, the first question is how to set the backcolor and forecolor to the left region, where the linenumber are...just black and white in reverse....
    Name:  sample5.jpg
Views: 800
Size:  14.6 KB
    I found this,

    Code:
    SCI_SETMARGINBACKN (int margin, color back)
    I add this to cDirectSCI .....
    Code:
    Public Function SetMarginBackN(margin As Long, color As Long) As Long
       'SCI_SETMARGINBACKN:  c_uint = 2250
      SetMarginBackN = SendEditor(2250, margin, color)
    End Function
    AND I must set style "linenumber" 0 ---> as type SC_MARGIN_COLOUR (6)
    /// Set the background colour of a margin. Only visible for SC_MARGIN_COLOUR.
    i obtain.... linenumber are gone....

    Name:  sample6.jpg
Views: 842
Size:  9.6 KB


    but I can't find his sister, ie the Setforeground .....I sincerely hope not to have anything to do with MASK delirium ...
    in scintillanet we have...
    scintilla.Styles.LineNumber.BackColor = Color.Blue;
    scintilla.Styles.LineNumber.ForeColor = Color.Cyan;

    Maybe another way?? perhaps with STYLE_LINENUMBER more or less .SendEditor SCI_STYLESETFORE (2051), STYLE_LINENUMBER (33) , SCI_FORECOL (white)


    2) I would like to create Custom folding but I have no idea how to introduce the keywords (ie #region #end region) in scintilla to VBscript lang and obtain Collapse/expand on it. In the picture, you can see the keywords #region....

    3) Last thing, little importance, I did't understand why some functions do not have the + and - folding marker, as I have highlighted with a circle in my picture. .... bah ....and not all lines are hidden, but some lines containing the custom keywords remain outside (see ExtractDoc for example).



    Thanks in advance for anyone who can help.



    ################## UPDATE HERE....



    I've resolve point 1)
    VERY SIMPLE!!! changing the style of LINENUMBER.... not 32 but 33.... obvious!

    STYLE_LINENUMBER = 33

    So we have simple 2 calls>

    Code:
          .SendEditor SCI_STYLESETFORE (2051), STYLE_LINENUMBER (33),    SCI_FORECOL   'RGB Fore color
          .SendEditor SCI_STYLESETBACK (2052), STYLE_LINENUMBER (33),    SCI_BACKGROUND 'SCI_BACKGROUND    'RGB bkcolor
    Last edited by Flauzer; Mar 13th, 2022 at 01:34 PM. Reason: found something...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width