Forum > SynEdit
[SOLVED] how to highlight SQL in SynEdit
pcurtis:
I drop a SynEdit and a TSynSQLSyn on a form.
Set the SynEdit highlighter property to SynSQLSyn.
Load a file SynEdit1.Lines.LoadFromFile('q1.sql');
The file loads but is not highlighted.
What am I missing?
jcmontherock:
You have to fill the object explorer of TSQLSyn. Do not forget to fill the HighLighter in SynEdit1.
pcurtis:
?
Any sample?
i tried this
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit Unit1; {$mode objfpc}{$H+} interface uses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, SynEdit, SynHighlighterSQL, SynHighlighterPas; type { TForm1 } TForm1 = class(TForm) SynEdit1: TSynEdit; SynSQLSyn1: TSynSQLSyn; procedure FormShow(Sender: TObject); private public procedure OpenFile(Const AFileName : String); end; var Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.OpenFile(Const AFileName : String);var sTEMP : string; F: TextFile;begin AssignFile(F, AFileName); Reset(F); while not EOF(F) do begin Readln(F, sTEMP); SynEdit1.Lines.Add(sTEMP); end; CloseFile(F);end; procedure TForm1.FormShow(Sender: TObject);begin SynEdit1.Clear; OpenFile('q1.sql');end; end.
And it still doesn't work.
AlexTP:
Offtopic. ATSynEdit component can highlight the SQL pretty fast. It needs ATSynEdit_Ex package with "lite lexer" component. Lite-lexer for SQL is present in CudaText editor.
pcurtis:
Not much help, if i can't get the standard version to work!
Navigation
[0] Message Index
[#] Next page