Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-11

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

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Eugen Bolz

Hey,

im trying to implement TSynCompletion with TSynEdit in a Project. But every time i select an Item at the TSynCompletion-Form and then trying to write something, the first char dont be added to the TSynEdit, i tried to copy the Functions of sourceeditor.pp ( of the IDE ) but theyre a bit complicated, and only i couldnt find any tutorial / demo.

I hope you know how to fix this.

Eugen

Reply by email

Brad Campbell
to Eugen Bolz
Eugen Bolz wrote 9 lines
Hey, im trying to implement TSynCompletion with TSynEdit in a Project. But every time i select an Item at the TSynCompletion-Form and then trying to write something, the first char dont be added to the TSynEdit, i tried to copy the Functions of sourceeditor.pp ( of the IDE ) but theyre a bit complicated, and only i couldnt find any tutorial / demo. I hope you know how to fix this.

Can you put together a simple program and upload it somewhere to demonstrate the fault?

Dolphins are so intelligent that within a few weeks they can train Americans to stand at the edge of the pool and throw them fish.

Reply by email

Eugen Bolz
to Brad Campbell
Brad Campbell wrote
Can you put together a simple program and upload it somewhere to demonstrate the fault?

http://eugen-bolz.de/syncompletion.zip

I have tested it again, it only dont works when SPACE is pressed, other CHARS are working.

Select one Item, after that press SPACE and the SPACE-Char dont get added , only on second press it will be added.

Also i have an other Question
If i type 's' instead of 'S' the SynCompletionForm dont reacts, how can deactivate the Case-Sensitive? or to do a workaround that this SynCompletion works like in the IDE

I hope it is understandable :)

Reply by email

Martin Friebe
to Eugen Bolz

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

Eugen Bolz wrote 24 lines
Brad Campbell wrote: > Can you put together a simple program and upload it somewhere to demonstrate the fault? > > http://eugen-bolz.de/syncompletion.zip I have tested it again, it only dont works when SPACE is pressed, other CHARS are working. Select one Item, after that press SPACE and the SPACE-Char dont get added , only on second press it will be added. Also i have an other Question If i type 's' instead of 'S' the SynCompletionForm dont reacts, how can deactivate the Case-Sensitive? or to do a workaround that this SynCompletion works like in the IDE I hope it is understandable :) _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Eugen Bolz
to Martin Friebe
Show quoted text 29 lines
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

Reply by email

Eugen Bolz
to Martin Friebe: I haven't fully investigated this, put it may be related to the fact that you install…
Show quoted text 29 lines
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

Reply by email