Hello!

I`ve got a problem with the fltk::Input::line_end(int) methode;
I want to count the lines of a text displayed inside a fltk 
wordwarp-output-widget.

My sourcecode looks like this:

int n = 0, current_pos = 0, max_pos = this->p_Output->size();

do
{
 // gehe zum Zeilende + 1 -> zur neuen Zeile
 current_pos            = this->p_Output->line_end(current_pos) + 1;
 n++;
} while(current_pos - 1 != max_pos);

this->p_Output is a pointer to a fltk::Output-widget with:
this->type(WORDWRAP);. So it`s a wordwrap-output.

If the value of p_Output is:
"  >>             Eingehend (03.00.2007, 19:32:03):
irgendwas mit dem film weiß aber nich mehr die aufgabenstellung und flö wills 
mir nich sagen

---------- ENDE ----------"

my sourcecode returns n (the number of lines) = 4, but that`s not correct, see 
screenshot:
http://img129.imagevenue.com/aAfkjfp01fo1i-20551/loc511/90901_screeny_123_511lo.jpg
If everything works correct, my code should return n = 5;

BUT for example if the value of the wordwrap-widget is:
"  >>             Eingehend (03.00.2007, 19:32:03):
irgendwas mit dem film weiß aber nich mehr die aufgabenstellung und flö wills 
mir nich sagenN

---------- ENDE ----------"

When adding "N" at the end of the last word ("sagen") of the wrapped line, than 
my code returns correctly n = 5.

What`s the problem here, can you help me?
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to