Fl_Help_View

42 views
Skip to first unread message

holm.h...@gmail.com

unread,
Apr 14, 2017, 7:48:40 AM4/14/17
to fltk.general

Hello everybody !

For the Fl_Help_View Widget, is it possible to get a horizontal scrollbar ?

Best regards
Håvard

Albrecht Schlosser

unread,
Apr 15, 2017, 12:44:36 PM4/15/17
to fltkg...@googlegroups.com
On 14.04.2017 13:48 holm.h...@gmail.com wrote:
>
> For the Fl_Help_View Widget, is it possible to get a horizontal scrollbar ?

Yes, it is. Please run test/help (1.3) or test/help_dialog (1.4) and
shrink the window horizontally to verify. A horizontal scrollbar appears
when there is content that is wider than the window, for instance tables
or <pre> formatted text. You may need to scroll down until you reach
such content.

Other than that, HTML text formatting is intended to wrap as much as
possible, hence a horizontal scrollbar will usually not appear.

Greg Ercolano

unread,
Apr 15, 2017, 1:08:40 PM4/15/17
to fltkg...@googlegroups.com
Ya, like a regular web browser, non-preformatted content will wrap.
To get the scrollbar, use <pre> for preformatted content that goes
beyond the edge of the screen, and it will be forced to scroll.

BTW, if you have some HTML content that goes off the edge of
the screen but /doesn't/ show a horizontal scrollbar to let you
see it, make an STR (Software Trouble Report) showing the HTML
content you're using so we can replicate + resolve. To work around
such a problem, you can probably include some wide <pre> formatted
text somewhere in the content to make the horizontal scrollbar appear.


holm.h...@gmail.com

unread,
Apr 15, 2017, 3:47:24 PM4/15/17
to fltk.general
I try the test/help program in the following html-code :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
<title>Info</title>
</head>
<body>

<TABLE>
<TR>
<TH ALIGN="Left" SCOPE="col" STYLE="background-color:#BD5729">Fartøy</TH>
<TH ALIGN="Left" SCOPE="col" STYLE="background-color:#BD5729">Landingsdato</TH>
<TH ALIGN="Left" SCOPE="col" STYLE="background-color:#BD5729">Mottak</TH>
<TH ALIGN="Left" SCOPE="col" STYLE="background-color:#BD5729">Fiskeslag</TH>
<TH ALIGN="Left" SCOPE="col" STYLE="background-color:#BD5729">Tilstand</TH>
<TH ALIGN="Left" SCOPE="col" STYLE="background-color:#BD5729">Størrelse</TH>
<TH ALIGN="Left" SCOPE="col" STYLE="background-color:#BD5729">Kvalitet</TH>
<TH ALIGN="Right" SCOPE="col" STYLE="background-color:#BD5729">Nettovekt</TH>
</TR>
<TR style="background-color: #FFFFFF">
<TD ALIGN="Left" valign="TOP" >aaaaa (fisk nr)</TD>
<TD ALIGN="Left" valign="TOP" >11-APR-17</TD>
<TD ALIGN="Left" valign="TOP" >hhhhhhheeeee akkkkkkkk (F440)</TD>
<TD ALIGN="Left" valign="TOP" >Kveite</TD>
<TD ALIGN="Left" valign="TOP" >Slmh</TD>
<TD ALIGN="Left" valign="TOP" >24,5+ Kg</TD>
<TD ALIGN="Left" valign="TOP" >A</TD>
<TD ALIGN="Right" valign="TOP" >199</TD>
</TR>

</TABLE>
</body></html>

I do not see the whole text, neigther a horizontal scrollbar..
I guess a solution could be to recode the html code, however in this case I do not have control of the html-code. It is downloaded from the net.

Best regards
Håvard


Greg Ercolano

unread,
Apr 15, 2017, 4:25:23 PM4/15/17
to fltkg...@googlegroups.com
On 04/15/17 12:47, holm.h...@gmail.com wrote:
> I try the test/help program in the following html-code :
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
> [..]
> </TABLE>
> </body></html>

Yes, looks like the <table> is going into word wrap, which does
surprise me. That should probably be fixed.

I'd like to see what others say, but I think even our simple HTML
widget shouldn't break a table into word wrap; the table should be
fixed, and provide a scrollbar if it's too wide. IMHO.

> I do not see the whole text, neigther a horizontal scrollbar..
> I guess a solution could be to recode the html code, however in this
> case I do not have control of the html-code. It is downloaded from the net.

I wouldn't expect random internet HTML content to work in
Fl_Help_View/Fl_Help_Dialog.

These widgets only understand a small subset of HTML commands,
and are meant for formatted help documentation where the content
is under the application developer's control.

For raw internet content, I'd strongly suggest opening an actual
web browser from your fltk app using:

fl_open_uri("http://what/ever.html")

Or use a third party FLTK widget that handles more complete HTML.

Otherwise, you'd have to parse the content and reformat it.. in
this case probably using Fl_Table or Fl_Browser using tab delimiting,
or some such.

Albrecht Schlosser

unread,
Apr 16, 2017, 5:26:41 AM4/16/17
to fltkg...@googlegroups.com
On 15.04.2017 22:25 Greg Ercolano wrote:
> On 04/15/17 12:47, holm.h...@gmail.com wrote:
>> I try the test/help program in the following html-code :
>>
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
>> [..]
>> </TABLE>
>> </body></html>
>
> Yes, looks like the <table> is going into word wrap, which does
> surprise me. That should probably be fixed.
>
> I'd like to see what others say, but I think even our simple HTML
> widget shouldn't break a table into word wrap; the table should be
> fixed, and provide a scrollbar if it's too wide. IMHO.

I agree although I don't know what the standard exactly says.

Something "simple" seems to be broken with width calculation anyway,
maybe because the table header is in a bold font? When shrinking the
window horizontally, parts of the rightmost column disappear ('vekt' and
'199') before word wrapping begins. That seems to indicate wrong text
width calculation.

Word wrapping inside particular columns seems to be okay - firefox does
it as well. But wrapping (and overwriting parts of) the table header
seems to be plainly wrong.

>> I do not see the whole text, neigther a horizontal scrollbar..
>> I guess a solution could be to recode the html code, however in this
>> case I do not have control of the html-code. It is downloaded from the net.
>
> I wouldn't expect random internet HTML content to work in
> Fl_Help_View/Fl_Help_Dialog.
>
> These widgets only understand a small subset of HTML commands,
> and are meant for formatted help documentation where the content
> is under the application developer's control.

Yes, that's the intention, AFAICT. For instance there's no CSS
implementation and it lacks more modern html keywords.

> For raw internet content, I'd strongly suggest opening an actual
> web browser from your fltk app using:
>
> fl_open_uri("http://what/ever.html")
>
> Or use a third party FLTK widget that handles more complete HTML.

What about Roman's proposal in STR #3240?
http://www.fltk.org/str.php?L3240

According to his description and screenshot(s) this widget ought to be
much better, i.e. more complete and standards compliant, for instance
http://www.fltk.org/strfiles/3240/screenshot-1.png

I suggest the OP may try this and report if it works better for his
application. Please report here and in STR. Sorry, I don't have enough
time to test myself right now...

Reply all
Reply to author
Forward
0 new messages