Fl_Input text size and height

13 views
Skip to first unread message

W. B.

unread,
May 14, 2021, 8:14:23 AM5/14/21
to fltk.general
I have a Fl_Table of widgets - let's say Fl_Input widgets.
The Table resize function is written so the table automatically resizes with Window width, and it's widgets resize accordingly. So I have some rows set to adjust their length. The same is done for the height of the widgets - multiline Fl_Inputs are taken into account and the row-sizes are adjusted.

It works pretty well with "normal" multiline Fl_Inputs by calculating the needed height and width by fl_measure - the newlines or empty lines are taken into account.

Is it possible to do the same with "wrap" Fl_Inputs? fl_measure looks only for newlines...

-> I need to calculate the "full needed" height of a "wrap" Fl_Input - the width of which is known/calculated before

I hope it's understandable what I mean

imm

unread,
May 14, 2021, 8:19:25 AM5/14/21
to general fltk
I'm on my phone so can't easily check, but ISTR that if you pass fl_measure a non-zero width, it will try to measure the height of wrapped to that width...

Or I may be misremembering and that's nonsense: but check out what the docs say, just in case!
--
Ian
From my Fairphone FP3

Albrecht Schlosser

unread,
May 14, 2021, 8:27:55 AM5/14/21
to fltkg...@googlegroups.com
On 5/14/21 12:35 PM W. B. wrote:
> I have a Fl_Table of widgets - let's say Fl_Input widgets.
> The Table resize function is written so the table automatically resizes
> with Window width, and it's widgets resize accordingly. So I have some
> rows set to adjust their length. The same is done for the height of the
> widgets - multiline Fl_Inputs are taken into account and the row-sizes
> are adjusted.
>
> It works pretty well with "normal" multiline Fl_Inputs by calculating
> the needed height and width by fl_measure - the newlines or empty lines
> are taken into account.
>
> Is it possible to do the same with "wrap" Fl_Inputs? fl_measure looks
> only for newlines...

see below ...

> -> I need to calculate the "full needed" height of a "wrap" Fl_Input -
> the width of which is known/calculated before
>
> I hope it's understandable what I mean

Unfortunately not, at least not for me. What do you mean with /"wrap"
Fl_Input/ ? This is not a term used in FLTK and FLTK Fl_Input widgets
don't wrap text AFAICT.

Regarding fl_measure(): you can initialize the argument 'int &w' with a
value other than 0 to wrap the text virtually within that width when
fl_measure() calculates the effective width and height.
https://www.fltk.org/doc-1.4/group__fl__drawings.html#gaccd92d0c0521b0aac30dcb856d438dcd
Reply all
Reply to author
Forward
0 new messages