[Gambas-user] gambas editor control and the highlight method

Sean seany at ...3224...
Fri Nov 8 09:29:46 CET 2013


  want that my program, at a click of the button will do 
some highlighting in the text in an editor (a component of 
gambas that you can add to a form).

So, in the form_open() method, i set :

programEdit.Styles[Highlight.Normal].Color = Color.Red
programEdit.Styles[Highlight.Keyword].Color = 
Color.DarkGreen

(my editor component is called programEdit)

then in the toolbutton1_click() method i set

programEdit.Highlight = Highlight.Custom

(should this not call the programEdit_highlight() method? 
)

In the programEdit_highlight, I set:

Dim z_c As Integer
Dim i As Integer
Dim z As String
Dim s As String

z = programEdit.Text '(this picks up the text in the 
editor)
z_c = String.Len(z)

For i = 1 To z_c
   s = Mid(z, i, 1) 'pick up each character
    If s = "s" Then 'i want the "s" -s to be dark green
    'Message("resetting highlight")
    Highlight.Add(Highlight.Keyword) 'according to the 
docs, this will set the highlight of a single character ..
    Highlight.State = Highlight.Keyword 'i dont know if i 
needed this, but even dropping it has no effect
    Else
    Highlight.Add(Highlight.Normal)
    Endif
Next

this should make the "s"- s dark green, and everything 
else red, but i am seeing everything simply red. where did 
i go wrong?




More information about the User mailing list