PDA

View Full Version : Ritchtext object, set text color OnFocus


djmoh
07-05-2008, 06:02 AM
hi,

i am back again with another question,
i am building a Counter-Strike: Souce Event_script editor...
for easy scripting matties eventscripts.

http://mattie.info

i have some problems, i need a syntax highlighter in the object.
so i want to us a ritch text object, an need so set some pieces of the text in defferent colors...

now i want to set if the text is "es_load" <- word must be blue
and if its "es_load ma_admingroups" es_load must be blue and ma_admingroups must be red and so on ...

how can i do this?


this code is working propperly, i want to add the highlighting in this code...
any one knows how ?

if someone comes with the idea i will add your credits to the editor !

my line of code is..

OnKey event of RTF object:

keywords = INIFile.GetValueNames("AutoPlay\\Docs\\Counter Strike.INI", "KeyWords");
keywords2 = INIFile.GetValueNames("AutoPlay\\Docs\\Counter Strike.INI", "KeyWords2");
keywords3 = INIFile.GetValueNames("AutoPlay\\Docs\\Counter Strike.INI", "KeyWords3");
reservedwords = INIFile.GetValueNames("AutoPlay\\Docs\\Counter Strike.INI", "ReservedWords");

keys = Table.Concat(keywords, "", 1, TABLE_ALL);
keys2 = Table.Concat(keywords2, "", 1, TABLE_ALL);
keys3 = Table.Concat(keywords3, "", 1, TABLE_ALL);
reserved = Table.Concat(reservedwords, "", 1, TABLE_ALL);

-- find all keywords
for i, v in keywords do
RichText.FindText("rtf_editor", keys, 1, -1, false, true);

end

-- find al keywords2
for i,v in keywords2 do
RichText.FindText("rtf_editor", keys2, 1, -1, false, true);
end

-- find all keywords3
for i,v in keywords3 do
RichText.FindText("rtf_editor", keys3, 1, -1, false, true);
end

-- find all reserved words or names.
for i,v in reservedwords do
RichText.FindText("rtf_editor", reserved, 1, -1, false, true);
end



thanks already ..
-=DJ_MOH=-