[Gambas-user] Need help with TextEditor

Bruce Steers bsteers4 at gmail.com
Wed Sep 15 12:31:43 CEST 2021


You need to study the gb.eval.highlight component.
http://gambaswiki.org/wiki/comp/gb.eval.highlight

You can see how it's used in gambas syntax highlighting by studying the
TextEditorMode_Style classes in the gb.form.editor component
https://gitlab.com/gambas/gambas/-/tree/master/comp/src/gb.form.editor/.src


I made the TextEditorMode_Sh.class and it was a real head scratcher.

Admittedly i used an existing class file and started the modifications from
there but you should find the methods you need looking at the above
code/help.

BruceS


On Wed, 15 Sept 2021 at 11:11, Rolf-Werner Eilert <rwe-sse at osnanet.de>
wrote:

> The TextEditor is nice - but I would need it in Custom mode for some of
> my own files.
>
>  From the example in the help I cannot see how to do that. Just to give
> you a hint what I need, here is a simple example of one of these files:
>
> This is text {b1}this is bold{b0} bold is off.
> Longer: {v§ if instr +Field1 [one] [write] else [this]}
>
> where everything in {} should be highlighted in blue and the strings in
> [] should be highlighted in green.
>
> There is one exception: Normally all {} are in one line only, there is
> merely one command {T... which can spread over several lines until the }
> comes.
>
> Now when I come into
>
> Public Sub TextEditor1_Highlight(Text As String)
>
> I understand I get the whole line in Text. Now will I have to make a
> loop and look into each character and pick it with string.mid()  and
> then TextHighlighter.Add TextHighlighter.State etc.?
>
> Or is there a way to just define {} for blue and [] for green?
>
> Is there an example for Custom mode somewhere?
>
> Thank you for your help!
>
> Regards
> Rolf
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210915/4b397d6b/attachment.htm>


More information about the User mailing list