Richedit control - margin with line numbers

Windows specific questions.
aurelVZAB
Posts: 666
Joined: Jul 02, 2008 14:55
Contact:

Richedit control - margin with line numbers

Post by aurelVZAB »

Hello
I do not ask about GUI things very much because there are lot of examples around net
but not about this one...

My question is :
is there a any example or piece of code (routines) to add line numbers into richedit control margin

thanks
Xusinboy Bekchanov
Posts: 783
Joined: Jul 26, 2018 18:28

Re: Richedit control - margin with line numbers

Post by Xusinboy Bekchanov »

Here you can:

Code: Select all

Dim fmt As ParaFormat2
fmt.cbSize = SizeOf(fmt)
fmt.dwMask = PFM_NUMBERING Or PFM_NUMBERINGSTART Or PFM_NUMBERINGSTYLE Or PFM_NUMBERINGTAB
fmt.wNumbering = 2
fmt.wNumberingStart = 1
fmt.wNumberingStyle = PFNS_PERIOD
SendMessage hwndRichEdit, EM_SETPARAFORMAT, 0, Cast(lParam, @fmt)
aurelVZAB
Posts: 666
Joined: Jul 02, 2008 14:55
Contact:

Re: Richedit control - margin with line numbers

Post by aurelVZAB »

Thanks i will try...
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Richedit control - margin with line numbers

Post by jj2007 »

It works only to a certain extent, Aurel, see here.
aurelVZAB
Posts: 666
Joined: Jul 02, 2008 14:55
Contact:

Re: Richedit control - margin with line numbers

Post by aurelVZAB »

It works excellent ...i mean qWord example in masm32
look on forum...
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Richedit control - margin with line numbers

Post by jj2007 »

It works excellent for small sources. Above 32768 lines it goes crazy.
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Richedit control - margin with line numbers

Post by dodicat »

Could somebody post a little intact example to run.
I was messing about making a code editor, so line numbers are a must.
Thank you.
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Richedit control - margin with line numbers

Post by jj2007 »

dodicat wrote:I was messing about making a code editor, so line numbers are a must.
See here for a better solution. I have never missed line numbers. If there is an error in my source, the editor jumps to that line, so why should I see the line number all the time to the left of my source? Of course, it should be available somewhere, in the status bar for example. But I would never allow an editor to waste valuable space for permanent line numbers.

Here is a demo showing line numbers in a RichEdit control. I find it awful.
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Richedit control - margin with line numbers

Post by dodicat »

Thanks jj2007.
I use fbide, line numbers can be turned off, the cursor jumps to an offending compile error anyway.
But I would like an example of fb code and rich edit and line numbers.
I suppose I could mess around myself and get there eventually, but I feel a bit lazy tonight.
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Richedit control - margin with line numbers

Post by jj2007 »

dodicat wrote:But I would like an example of fb code and rich edit and line numbers.
I suppose I could mess around myself and get there eventually, but I feel a bit lazy tonight.
Xusinboy's solution works.
aurelVZAB
Posts: 666
Joined: Jul 02, 2008 14:55
Contact:

Re: Richedit control - margin with line numbers

Post by aurelVZAB »

Above 32768 lines it goes crazy
come on JJ, which hobby programmer need such a large amount of lines?
and for me line numbers are standard for any editor
aurelVZAB
Posts: 666
Joined: Jul 02, 2008 14:55
Contact:

Re: Richedit control - margin with line numbers

Post by aurelVZAB »

WOW
hey JJ
Is it normal that admin on masm forum is so unfriendly?
And what is wrong in asking for help?
that is really strange...
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Richedit control - margin with line numbers

Post by jj2007 »

No, that's normal, Aurel. He is a nice guy otherwise, but don't dare to bring disorder in his house ;-)
aurelVZAB
Posts: 666
Joined: Jul 02, 2008 14:55
Contact:

Re: Richedit control - margin with line numbers

Post by aurelVZAB »

Normal...
ahh yeah attack is the best defend..heh
it looks to me that he reacted when i say OxygenBasic.
It seems to me that many people on other forums don't like it ...ahh long story
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Richedit control - margin with line numbers

Post by dodicat »

Yea well, I think Hutch has got a problem.
Mnemonic Driven API Grinder doesn't seem too laid back to me.
Nil desperandum carburundum seems appropriate.
I dowloaded oxygen basic, and it looked promising, but my AVIRA got it on the first example, and it now lies in the quarantine pit.
Never mind.
Post Reply