Hi there, I've mostly worked out how to use code completion in SynEdit, but for some reason just pressing CTRL+Space didn't work, I would assume because I'm controlling my own key down event's, so that's okay I figured out how to invoke the code completion okay, but now with the code below it only opens at the mouse pointer, I was wondering if there's a way to figure out the location on the screen the caret is and open it there?
Any help would be appreciated. I have...
procedure TfrmMain.synEditKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
pnt : TPoint;
startPos, endPos, a, len : Integer;
txt, str : STring;
begin
if synEdit.Modified then FModified := true;
if (key=32) then
begin
if ssCTRL in shift then
begin
endPos := synEdit.CaretX;
txt := synEdit.Lines[SynEdit.CaretY-1];
str := '';
for a := endPos downto 0 do
begin
if (txt[a] = ' ') or (txt[a]= #10) or (a<=0) then
begin
startpos := a+1;
len := endPos - StartPos;
str := Copy(txt, startPos, len);
str := trim(str);
end;
end;
pnt := mouse.CursorPos;
if str<>'' then
SynCompletion.Execute(str, pnt.x, pnt.y);
end;
end;
end;