[Lazarus] After using TSynCompletion, the SynEdit dont want to write the first Char, but after the first Char all works

Eugen Bolz info at eugen-bolz.de
Tue Nov 11 13:41:27 CET 2008


Martin Friebe schrieb:
> Hi,
>
> I haven't fully investigated this, put it may be related to the fact 
> that you install some custom onKeyPressed stuff.
>
> The original procedure TSynCompletion.EditorKeyPress(Sender: TObject; 
> var Key: char);
> does:
>     if TRecordUsedToStoreEachEditorVars(fEditstuffs[i]^).NoNextKey then 
> begin
>       key := #0;
>       TRecordUsedToStoreEachEditorVars(fEditstuffs[i]^).NoNextKey := false;
>     end;
>
> This procedure is still installed in Synedits OnKeyPress. So in theory 
> any first key, after completion is skipped
>
> In Praxis, due to what is a likely bug (but different bug) in Synedit: 
> only spaces, upper-case chars and some punctuation is ignored.
> In your example they are also ignored, if you finish completion, add 
> some lower case, and then try space or upper-case.
>
> I have not tested, but you may get round the issue, by removing the 
> OnKeyPressed from Synedit, after SynCompletition did install it.
> The better option is to find out, how to get SynCompletition to properly 
> finish.
>
> Best Regards
> Martin

Thank you, now it works with this Workaround,

procedure TForm1.ccExecute(Sender: TObject);
begin
  if FLastKeyPress <> nil then begin
      SynEdit1.OnKeyPress:= FLastKeyPress;
  end;
end;

procedure TForm1.SetFocusAll;
begin
    SetFocus;
    SynEdit1.SetFocus;

    FLastKeyPress:=SynEdit1.OnKeyPress;

    SynEdit1.OnKeyPress:=nil;
end;

but i have an other problems with SynCompletion , too

in the IDE i can type a 'c' or 'C' to select an item like 'Create', with
the Normal SynCompletion i have to use 'C' to select 'Create', someone
know something about this?

Best Regards,
Eugen



More information about the Lazarus mailing list