Scintilla gadget (Line numbering) [Solved]

Everything else that doesn't fall into one of the other PB categories.
mocitymm
User
User
Posts: 37
Joined: Wed Feb 08, 2017 6:56 pm

Scintilla gadget (Line numbering) [Solved]

Post 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
Last edited by mocitymm on Wed Apr 01, 2020 12:39 am, edited 1 time in total.
User avatar
Shardik
Addict
Addict
Posts: 1991
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Scintilla gadget (Line numbering)

Post 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
User avatar
Tenaja
Addict
Addict
Posts: 1949
Joined: Tue Nov 09, 2010 10:15 pm

Re: Scintilla gadget (Line numbering)

Post 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.
mocitymm
User
User
Posts: 37
Joined: Wed Feb 08, 2017 6:56 pm

Re: Scintilla gadget (Line numbering)

Post by mocitymm »

Shardik and Tenaja,

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

Regards,

-M
User avatar
Tenaja
Addict
Addict
Posts: 1949
Joined: Tue Nov 09, 2010 10:15 pm

Re: Scintilla gadget (Line numbering) [Solved]

Post 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.)
Post Reply