[Gambas-user] TextArea Line Numbering And Syntax High lighting?

Benoit Minisini gambas at ...1...
Fri Aug 19 17:19:00 CEST 2005


On Thursday 18 August 2005 21:46, Rob wrote:
> On Wednesday 17 August 2005 15:14, Steve Starr wrote:
> > Things are crashing like when i try to use the new wizard feature
> > etc. Now i am useing Kde 3.4.1 and  Qt 3.3.4 do i need to upgrade
> > Qt to 4.0 to get gambas 1.9.16 more stable than what it is?
>
> No, I'm not even sure gambas will compile under qt4 yet.  The 1.9
> series is pretty unstable and I wouldn't suggest using it for any
> important projects yet.... but if you would post detailing all the
> crashes you got so we can try to duplicate and then eliminate them,
> that would be awesome.
>
> The client I'm visiting today actually wrote a COBOL editor in Gambas
> (reimplemented from scratch based on an old VB app) and we did line
> highlighting by making arrays of text boxes, 3 for each row (the
> COBOL they use has three fields in each line) and 24 rows per screen
> (adjustable in software, but they wanted to keep it similar to what
> they had.) Scroll bars, multi-line selections, the whole nine yards.
> (As it happens, the Gambas program is on the order of 5-10 times
> faster than the VB program it replaced despite all that tricky
> coding, so there isn't much of a performance hit.)
>
> I hope in the future I can get them to reimplement it using the Gambas
> editor control in Gambas 2.x, but until it's stable the best solution
> might be the array of text boxes, each row being the line number
> followed by the code for that line. You'll need to do some STOP EVENT
> stuff in the keypress event handler so that when the user presses the
> up arrow your program moves to the previous line rather than one
> character back in the current one.
>
> Unfortunately, that wouldn't give you syntax highlighting, just line
> highlighting.  So you still may need to implement each line as a
> TextLabel, storing the lines of code themselves in a separate array
> offscreen, and whenever they cursor down to that line, pop up a
> TextBox on top of the label and let them edit the line (without
> highlighting, alas, but I've seen a lot of editors that work that way
> including VB's.)
>
> I'm actually not sure how you'd do this with VB's rich text control
> either, so I don't feel that bad about it.
>
> Rob
>

The Editor control in the development version gb.qt.ext class was made so that 
it will be able to support custom syntax highlighting in the future. I think 
it will be a event like "Highlight this line" that will just give you the 
highlight begin state of the current line, and that will ask you in return 
the highlighted line, and the highlight end state.

I am amaze that you did a highlighting text editor with arrays of textboxes... 
What a horrible hack! ;-) - Well, I made the DateBox (and TimeBox) control in 
the upcoming 1.9.17 with three textboxes...

That it is 5/10 times faster than the old VB program is a good news too :-)

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list