MacArthur, Ian (SELEX GALILEO, UK) wrote:

> 
>> I'm using fltk 1.1.8. How can I get current cursor position in
>> Fl_Text_Editor ?
>> I would like to make somenthing like this ?
>> 
>> This is Fl_Text_Editor:
>> ex.1
>> +----------+
>> |aaaaaaaaa |
>> |aaa       |
>> |c|        |
>> +----------+
>> 
>> Position format is (line number), (character number). In this
>> example (ex.1)
>> cursor position is 3, 2. Thx !
> 
> The underlying editor widget is based on Nedit, so any notes on using
> the Nedit codes might be pertinent.
> 
> Anyway, I *think* it goes something like this (this is from memory, I
> haven't used the Fl_Text_Editor stuff much recently...)
> 
> You find the current insert position like:
> 
> pos = myeditor->insert();
> 
> Then find the line number:
> 
> line = myeditor->count_lines(pos);
> 
> Then the line start char:
> 
> start = myeditor->line_start(pos);
> 
> Then the character number is
> 
> charpos = pos - start;
> 
> 
> Well, something like that, anyway...
> 
> 
> 
> 
> SELEX Sensors and Airborne Systems Limited
> Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex
> SS14 3EL
> A company registered in England & Wales.  Company no. 02426132
> ********************************************************************
> This email and any attachments are confidential to the intended
> recipient and may also be privileged. If you are not the intended
> recipient please delete it from your system and notify the sender.
> You should not copy it or use it for any purpose nor disclose or
> distribute its contents to any other person.
> ********************************************************************

I found those methods in documentation this is the changed code:

Fl_Text_Editor text_editor;
Fl_Text_Buffer buf_editor;
text_editor->buffer(buf_editor);

        int pos = text_editor->insert_position();
        int start = buf_editor->line_start(pos);
        int line = buf_editor->count_lines(start, pos);
        int charpos = pos - start;

How can I detect that the Fl_Text_Buffer (buf_editor) is modified so I can
redraw/redisplay new cursor position ?

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to