Page 1 of 1

Scintilla gadget (Line numbering) [Solved]

Posted: Tue Mar 31, 2020 8:42 pm
by mocitymm
Was wondering if the Scintilla gadget supports line number on the left side?

As in:

1: Blah blah
2: Blah blah
3: Same, etc...

All I could find was this post and it didn't seem to answer it fully. https://www.purebasic.fr/english/viewto ... ne+numbers

Or is there an alternative to use for instead. I am sure that most likely has been asked before but, I could not find the answer.

Regards,

-M

Re: Scintilla gadget (Line numbering)

Posted: Tue Mar 31, 2020 9:29 pm
by Shardik
mocitymm wrote:Was wondering if the Scintilla gadget supports line number on the left side?
The following example displays a yellow line number area for two digits (tested successfully on Windows 10 x64 V1809 with PB 5.71 x86 and x64):

Code: Select all

OpenWindow(0, 100, 100, 320, 110, "ScintillaGadget")

If InitScintilla()
  ScintillaGadget(0, 10, 10, 300, 90, 0)
  *Text = UTF8("<= With 2-digit line numbers")
  ScintillaSendMessage(0, #SCI_SETTEXT, 0, *Text)
  FreeMemory(*Text)
  
  ; ----- Set line number margin to display 2 digits
  ;       (Default width 0: invisible)
  ScintillaSendMessage(0, #SCI_SETMARGINWIDTHN, 0, 20)

  ; ----- Set background color of line number margin to yellow
  ScintillaSendMessage(0, #SCI_STYLESETBACK, #STYLE_LINENUMBER, #Yellow)
  
  ; ----- Hide non-folding symbol margin (default width 16)
  ScintillaSendMessage(0, #SCI_SETMARGINWIDTHN, 1, 0)

  Repeat
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf

Re: Scintilla gadget (Line numbering)

Posted: Tue Mar 31, 2020 9:55 pm
by Tenaja
mocitymm wrote:Was wondering if the Scintilla gadget supports line number on the left side?

As in:

1: Blah blah
2: Blah blah
3: Same, etc...

All I could find was this post and it didn't seem to answer it fully. https://www.purebasic.fr/english/viewto ... ne+numbers

Or is there an alternative to use for instead. I am sure that most likely has been asked before but, I could not find the answer.

Regards,

-M
Yes, it does. It supports all of the scintilla commands within the given scintilla version. (Not typically the newest.)

Find the command list here:
https://www.scintilla.org/ScintillaDoc.html

If a command is not valid, look at the scintilla history file and verify it wasn't added after the PB version.

Re: Scintilla gadget (Line numbering)

Posted: Wed Apr 01, 2020 12:38 am
by mocitymm
Shardik and Tenaja,

Thank you both, exactly what I needed! Much appreciated.

Regards,

-M

Re: Scintilla gadget (Line numbering) [Solved]

Posted: Wed Apr 01, 2020 3:06 am
by Tenaja
If you look for the GoScintilla library in the forum, you will find not only a great library, but also most of the constants defined. (Which is helpful if you just want a simple or focused application.)