Sign in Join

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

Mailing lists / lazarus / 2013-07

SynEdit Code Completion

6 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

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

Friedemann Stoffregen

Hi everyone.
Can anyone tell me how I can add a codecompletion (similar to CTRL+Space in Lazarus) to my own application? I had a look at the example / Synedit / Autocomplete demo, but it was not what I was looking for.

Maybe someone can tell me where I have to look to understand the way Lazarus adds it?

Sorry for my very bad english,

Friedemann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130708/90c71628/attachment.html>

Reply by email

Martin
to Friedemann Stoffregen: Hi everyone. Can anyone tell me how I can add a codecompletion (similar to CTRL+Space in…
Friedemann Stoffregen wrote 9 lines
Hi everyone. Can anyone tell me how I can add a codecompletion (similar to CTRL+Space in Lazarus) to my own application? I had a look at the example / Synedit / Autocomplete demo, but it was not what I was looking for. Maybe someone can tell me where I have to look to understand the way Lazarus adds it?

examples\SynEdit\Completion\unit1.pas does exactly this. It contains 2 types of completion.

The one you want is:
ctrl-space (which uses SynCompletion1: TSynCompletion )

The completion list must be filled by your code, there is no ready made code for this.

And if you want to hide none-matching entries while you type, then you need to copy the filter in DoSearchPosition

look at the 2 events assigned in object inspector.

Reply by email

Mattias Gaertner
to Martin
Show quoted text 24 lines
On 08/07/2013 21:45, Friedemann Stoffregen wrote: > Hi everyone. > Can anyone tell me how I can add a codecompletion (similar to > CTRL+Space in Lazarus) to my own application? I had a look at the > example / Synedit / Autocomplete demo, but it was not what I was > looking for. > > Maybe someone can tell me where I have to look to understand the way > Lazarus adds it? > examples\SynEdit\Completion\unit1.pas does exactly this. It contains 2 types of completion. The one you want is: ctrl-space (which uses SynCompletion1: TSynCompletion ) The completion list must be filled by your code, there is no ready made code for this. And if you want to hide none-matching entries while you type, then you need to copy the filter in DoSearchPosition look at the 2 events assigned in object inspector.

Maybe you can add some more comments to the example?

Mattias

Reply by email

Martin
to Mattias Gaertner
Mattias Gaertner wrote
Maybe you can add some more comments to the example?

There is a readme, that is also displayed in the example manager. It explains the difference between the 2 completions

The code is very simple (but yes maybe one or 2 comments).

But the problem of the OP seems something else

Can anyone tell me how I can add a codecompletion (similar to CTRL+Space in Lazarus) to my own application? I had a look at the example / Synedit / Autocomplete demo, but it was not what I was looking for.

Well, if he runs it, the runtime is self-explaining. And it acts 100% like the IDE. So not sure why that example is not what he is looking for?

--- readme
Example for SynEdit's auto-completion features.

SynEdit (the editor used by the IDE) provides 2 different auto-completion features:

1) TSynCompletion (The word completion feature used by the IDE) Displays a drop-down providing a list of completions (or replacements) for the current word. The completions, must be provided, and updated by the application.
If the user typed "Sel", then a list of words beginning with "Sel" may be displayed.

2) TSynAutoComplete
Replaces the current word/token, with a fixed pre-defined substitution. If the user typed "IB", the replacement may be "if foo then begin"

Reply by email