[Lazarus] SynEdit
patspiper
patspiper at gmail.com
Mon Apr 4 18:23:37 CEST 2011
On 04/04/2011 06:47 PM, Martin wrote:
> On 04/04/2011 16:44, patspiper wrote:
>> On 04/04/2011 06:30 PM, Martin wrote:
>>> On 04/04/2011 16:20, patspiper wrote:
>>>> Hi,
>>>>
>>>> 1- How can TSynCompletion's ItemList be filled depending on what is
>>>> before the dot(.)? I know the Lazarus IDE does it, but I couldn't
>>>> figure it out.
>>>>
>>>> TEdit.|
>>>>
>>>> If Ctrl+Space is pressed, then the list of TEdit properties should
>>>> popup. Currentstring is empty. How can we read the word before the
>>>> dot?
>>>
>>> There is an example on how to use it, in the example folder.
>>>
>>> It should show you which callbacks are triggered, so you can place
>>> code of your own there.
>> I checked the 3 examples before posting. They show how to use
>> CurrentString (which is after the dot), but not how to read the token
>> before the dot.
>
> ok, I may be able to look into it later.
>
> but what about using LogicalCaretXY, then getting the line, and
> reading it?
>
> possible subtracting the length of CurrentString.
I am almost there (by giving it another shot at the ide sources):
Line:=SynEdit1.LineText;
p1:=SynEdit1.LogicalCaretXY;
if (p1.x>length(Line)+1) or (Line='') then exit;
SynEdit1.GetWordBoundsAtRowCol(p1, x1, x2);
// There must be a saner way than subtracting 2
p1.x := x1-2;
SynEdit1.GetWordBoundsAtRowCol(p1, x1, x2);
WordToken := copy(Line, x1, x2);
However, what is the correct way to go back to the previous token?
Subtracting 2 is not the way.
Thanks,
Stephano
More information about the Lazarus
mailing list