[Gambas-user] Need help with TextEditor

bb adamnt42 at gmail.com
Sat Sep 18 19:11:20 CEST 2021


On Sat, 2021-09-18 at 16:08 +0100, Bruce Steers wrote:
> On Fri, 17 Sept 2021 at 15:29, Rolf-Werner Eilert <rwe-sse at osnanet.de
> >
> wrote:
> 
> > Am 16.09.21 um 19:09 schrieb Bruce Steers:
> > > 
> > > On Thu, 16 Sept 2021 at 16:40, Rolf-Werner Eilert <
> > > rwe-sse at osnanet.de
> > > <mailto:rwe-sse at osnanet.de>> wrote:
> > > 
> > >     Thank you for the links, Bruce. I browsed through several
> > > source
> > files,
> > >     and think I understood the principle.
> > > 
> > >     What I miss is, how do I tell the highlighter which style is
> > > which
> > >     color?
> > > 
> > >     In the HTML code for instance there is
> > > 
> > >     Add(sQuote, Highlight.String)
> > > 
> > >     But where is a definition for the color for Highlight.String?
> > > I
> > >     remember
> > >     in the old editor, I had to define colors for these.
> > > 
> > >     If I get that to run, I guess I could do the rest by code. In
> > > my case
> > >     it's only two colors other than "Normal", one for "command"
> > > and one
> > for
> > >     "string".
> > > 
> > >     Regards
> > >     Rolf
> 
> No i'm afraid not.
> it's worse than that I think.
> You cannot currently create your own TextEditor highlighting routines
> without importing gb.form.editor and gb.eval.highlight into your
> project.
> (as far as i know,   i think this is what Ben meant by a parser
> generator)
> 
> If you look at my ScriptEd project source here..
> https://gitlab.com/bsteers4/scripted/-/tree/old-gambas/.src
> 
> you can see 2 folders , TextEditor and gb.eval.highlight  , they are
> just
> copies of gb.form.editor and gb.eval.highlight.
> I imported the folders from gambas source then de-selected the
> components
> from my project properties as they were now built in.
> I added the TextHighlighter_Sh.class to gb.eval.highlight/ and the
> TextEditorMode_Sh.class to TextEditor/ (they started as copies of the
> C
> highligher) to that application before Sh highlighting was added to
> gambas.
> 
> So i think currently this will be the only way t create your own
> independent highlighter/mode
> 
> Though i could be mistaken and need correcting on this.
> Could someone (Ben) please confirm/deny if add-on highlighting can be
> done
> or is it the internal classes only that will highlight?
> 
> All the best
> BruceS
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----

Have you tried overloading the relevant classes in your project?
I remember I did that once with Color.class to turn the constants into
properties so they were writable. (That class is not relevant for this
matter though. Also it is no longer relevant/required since Color was
enhanced a long while back.)
In this case, maybe adding a method is all that is required?

b



More information about the User mailing list