[Gambas-user] TextArea.ToLine(x) confusing

Benoit Minisini gambas at ...1...
Sat Mar 20 10:02:22 CET 2004


On Friday 19 March 2004 13:05, Eilert wrote:
> Hi,
>
> I've almost finished my first project with Gambas - absolutely amazing
> thing :-)
>
> However, when I wanted to make a function that outputs the text from
> TextArea1 to the printer, I found that the TextArea1.ToLine(x) function
> does NOT return the line but the paragraph - apparently it is programmed
> to count the number of CRs in the text. As long as the TextArea's "Wrap"
> is not set to True, this makes sense (every line is a paragraph).

I can't change that, because it is the behaviour of the widget in QT. It 
counts paragraphs, not line. I kept the word line, and I agree it becomes 
strange when Wrap is True.

>
> In my case, "Wrap" is set to True, enabling the TextArea to work like a
> real text input field and delimiting the line width to the width of the
> text area. When you give ToLine the number of the character in the text,
> you would expect to have the actual line returned here.
>
> Now, is there a way of having TextArea telling me on what line the
> cursor (or printing counter, resp.) is standing, or will I really have
> to make a function that recalculates the line wrapping for the printing?

At the moment, you must do it by hand with Font.TextWidth. I think I will make 
a function HeightForWidth that will return a text height when the width is 
given.

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list