Recent

Author Topic: Add additional Text to SynComplete  (Read 2610 times)

sorakun

  • Newbie
  • Posts: 5
  • There is a monster in all of us.
Add additional Text to SynComplete
« on: November 27, 2013, 07:45:29 pm »
Hello everyone.

I need to add additional text a SynComplete component, just like in lazarus IDE, show the function return type, its parameters, etc.

Thanks.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12202
  • Debugger - SynEdit - and more
    • wiki
Re: Add additional Text to SynComplete
« Reply #1 on: November 27, 2013, 07:49:34 pm »
The IDE draws each item itself. There is an event for that.

Maybe there is an easier way. Not tried...

Look at the example. I know, it does not put additional text in there... But it shows the usage.

You can fill the list with anything you want, then in the correct event, when the user changed the text, you specify which entry to display. (position)

It should be possible.


sorakun

  • Newbie
  • Posts: 5
  • There is a monster in all of us.
Re: Add additional Text to SynComplete
« Reply #2 on: November 27, 2013, 08:20:09 pm »
Thank you very much for your reply. Tell me if this is a good way: I should create double TString items for example, and if he applies the one in the item which belong to the SynComplete, I replace it with the first in the back up list which got the real tokens string.
I'm not sure if I can change the color or the keywords in the SynComplete.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12202
  • Debugger - SynEdit - and more
    • wiki
Re: Add additional Text to SynComplete
« Reply #3 on: November 27, 2013, 08:41:22 pm »
How you store the mapping between display and keyword, is not related  to SynCompletion.

Lots of ways:
- 2 stringlists, both the same order, items at same index, belong together.
- array of record s1,s2:string; end;
- ...


Assign
    SynCompletion1.OnSearchPosition := @DoSearchPosition

And in
procedure TForm1.DoSearchPosition(var APosition: integer);

you can:
- set APositon to indicate which entry to highlight
- filter the list, an remove or add entries

The filtering is done in the example (see folder example/synedit)

----
    SynCompletion1.OnCodeCompletion
can be used to insert the correct text in the editor.

 

TinyPortal © 2005-2018