Hallo!
Ich wollte dem User meines Proggs die möglichkeit geben, die Highlighter selbst einzustellen. damit ich das ganze Zeug nicht immer schreiben muss, habe ich folgende Fkt geschrieben:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
| function TForm1.SetAttr: TSynHighlighterAttributes; begin result:= TSynHighlighterAttributes.Create(''); result.Foreground:= pVGColor.Color; result.Background:= pHGColor.Color; result.Style:= []; if cbBold.Checked then result.Style:= result.Style + [fsBold]; if cbItalic.Checked then result.Style:= result.Style + [fsItalic]; if cbUnderline.Checked then result.Style:= result.Style + [fsUnderline]; if cbStrikeOut.Checked then result.Style:= result.Style + [fsStrikeOut]; end; |
und dann aktualiesiere ich die Highlighter je nach ListBox / COmboBox eintrag
Delphi-Quelltext
1: 2: 3: 4: 5:
| case lbElement.ItemIndex of 0: synHLhtml.AndAttri:= SetAttr; 1: synHLhtml.ASPAttri:= SetAttr; 2: synHLhtml.CommentAttri:= SetAttr; ... |
geht alles prima, im Vorschau synedit wird alles richtig angezeigt, aber wenn ich dann
Delphi-Quelltext
1:
| synHLhtml.SaveToFile('C:\test.hl'); |
aufruf, speichert er immer die Einstellungen, die der Highlighter von Anfang an hatte.
Ich versteh nun wirklich nicht, woran das liegt. Hat jmd eine Idee? NOtfalls müsste ich die Speicher- und Laderoutine selbst schreiben... *brr*
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49:
| [Asp] Background=65535 Foreground=0 Style=0
[Comment] Background=536870911 Foreground=536870911 Style=0
[Escape ampersand] Background=536870911 Foreground=65280 Style=1
[Identifier] Background=536870911 Foreground=536870911 Style=1
[Reserved word] Background=536870911 Foreground=16711808 Style=1
[Space] Background=536870911 Foreground=536870911 Style=0
[Symbol] Background=536870911 Foreground=536870911 Style=1
[Text] Background=536870911 Foreground=536870911 Style=0
[Unknown word] Background=536870911 Foreground=255 Style=1
[Value] Background=536870911 Foreground=16744448 Style=0 |