Richedit control - margin with line numbers

Windows specific questions.
aurelVZAB
Posts: 330
Joined: Jul 02, 2008 14:55
Location: Croatia
Contact:

Richedit control - margin with line numbers

Postby aurelVZAB » Feb 14, 2020 10:51

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: 221
Joined: Jul 26, 2018 18:28

Re: Richedit control - margin with line numbers

Postby Xusinboy Bekchanov » Feb 14, 2020 15:10

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: 330
Joined: Jul 02, 2008 14:55
Location: Croatia
Contact:

Re: Richedit control - margin with line numbers

Postby aurelVZAB » Feb 14, 2020 16:16

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

Re: Richedit control - margin with line numbers

Postby jj2007 » Feb 14, 2020 17:38

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

Re: Richedit control - margin with line numbers

Postby aurelVZAB » Feb 14, 2020 19:43

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

Re: Richedit control - margin with line numbers

Postby jj2007 » Feb 14, 2020 20:39

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

Re: Richedit control - margin with line numbers

Postby dodicat » Feb 14, 2020 21:13

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: 1462
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Richedit control - margin with line numbers

Postby jj2007 » Feb 14, 2020 22:56

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: 6488
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Richedit control - margin with line numbers

Postby dodicat » Feb 14, 2020 23:53

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: 1462
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Richedit control - margin with line numbers

Postby jj2007 » Feb 15, 2020 1:27

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: 330
Joined: Jul 02, 2008 14:55
Location: Croatia
Contact:

Re: Richedit control - margin with line numbers

Postby aurelVZAB » Feb 15, 2020 7:35

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: 330
Joined: Jul 02, 2008 14:55
Location: Croatia
Contact:

Re: Richedit control - margin with line numbers

Postby aurelVZAB » Feb 15, 2020 8:55

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: 1462
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Richedit control - margin with line numbers

Postby jj2007 » Feb 15, 2020 9:04

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

Re: Richedit control - margin with line numbers

Postby aurelVZAB » Feb 15, 2020 10:00

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: 6488
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Richedit control - margin with line numbers

Postby dodicat » Feb 15, 2020 11:41

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.

Return to “Windows”

Who is online

Users browsing this forum: No registered users and 2 guests