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

Rob sourceforge-raindog2 at ...94...
Thu Aug 18 21:46:53 CEST 2005


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








More information about the User mailing list