HtmlPanel - rich text on the device

Byak@

Active Member
Licensed User
Agraham,as i understand it is not real to add checkboxes, textboxes and more to htmlpanel?as in webbrowser?
 

BjornF

Active Member
Licensed User
Longtime User
Dear Andrew,

Very nice library !

Unfortunately I'm not able to open the help file - all I get is "The address is not valid" (irrespective if the help file is in its "proper place" among the libraries and I open it via the Basic4ppc or if I try to open it directly).

Can you help?

all the best / Björn


Edit:
Anyway I just solved the problem - or rather you did it for me Andrew, in a previous post - by right clicking, choosing properties and then "unblock" if anyone is wondering
 
Last edited:

BjornF

Active Member
Licensed User
Longtime User
Dear Andrew,

I am trying to write an ebook reader with your htmlPanel. Most of my files are plain text-files, so what I do is that I add/replace:
B4X:
txt=StrReplace(txt,CRLF,"<br/>")
txt=StrReplace(txt,"&","&amp;")
txt="<html>" & "<Body>" & "<Font size="& q & FSize & q &">" & txt & "</Font>" & "</Body>" & "</html>"

and then htmlPanel.ShowHtml(txt)

This works fine for the Pc version, and for files of up to approx 20 kB, but over that I get an OutOfMemoryException at the htmlPanel command - despite having >60MB memory free.

Is this some kind of "natural" limit? :confused:
And of course, is there some way around it? :)

All the best / Björn
 

Byak@

Active Member
Licensed User
Hi Agraham.
please add a new tag: <hide>...</hide>.I think you undestand what it do =)
and...i have an idea.Changeble color's constants.
for example 'htmlpanel1.color1' and 'htmlpanel1.color2'.and in xhtml source code '<font color=color1>'.and when we change color1 it Automatically changhed in source and redraw.
what you say about it?
 

agraham

Expert
Licensed User
Longtime User
please add a new tag: <hide>...</hide
Is there a reason why you can't use comment tags <!-- this won't show -->?

I can do custom colors like this but you will need to invoke the redraw explicitly.
B4X:
   HtmlPanel.ChangeColor("color1", cGold) ' color1 to color5 are supported
   HtmlPanel.ShowHtmlFile(html)
 

Byak@

Active Member
Licensed User
Is there a reason why you can't use comment tags <!-- this won't show -->?
ooops)i'm don't know about it.

I can do custom colors like this but you will need to invoke the redraw explicitly.
B4X:
    HtmlPanel.ChangeColor("color1", cGold) ' color1 to color5 are supported
    HtmlPanel.ShowHtmlFile(html)
ok)how many constants do you add?now i think...this constants сan be useful for fontsize too.:sign0060:
 

Byak@

Active Member
Licensed User
Andrew,i'm try to do cinematic scroll for htmlpanel.in desctop all work good but on device 'mousemove' event doesn't work correct..,
look please.
 

Byak@

Active Member
Licensed User
oops. The problem was in started FTouchSL. Now all is good
wait for new version of htmlpanel =)
 

Byak@

Active Member
Licensed User
i'm playing with lib and... :-[ ...what i'm need:
1)href parametr (as in links) for Images.
2)new Method for checking type of content on specifid X and Y (without clicking).
 

agraham

Expert
Licensed User
Longtime User
ok)how many constants do you add?now i think...this constants сan be useful for fontsize too
I was going to add 5 custom colors which I thought would be enough. It is not really possible to do the same with Font sizes as, unlike colors, they are not symbolic constants and the structure of the code expects numeric values.
1)href parametr (as in links) for Images.
Sorry, but I don't understand this. Can you explain giving the HTML you might expect to write and the effect you want.
2)new Method for checking type of content on specifid X and Y (without clicking).
Yes, I can provide the same information as the ClickedItemText and ClickedItemType properties would return for a MouseDown at the same X and Y.
 

Byak@

Active Member
Licensed User
Sorry, but I don't understand this. Can you explain giving the HTML you might expect to write and the effect you want.
now LinkClick event fired when we click on Link.and htmlpanel.href contain a 'href' parametr.
and i want when we click on Image 'LinkClick' event fired too.and htmlpanel.href contain a 'href' parametr.
it will be very good and add more functionality.
 

agraham

Expert
Licensed User
Longtime User
and i want when we click on Image 'LinkClick' event fired too.and htmlpanel.href contain a 'href' parametr.
I'm sorry but I still don't understand. How is this href parameter defined? Do you expect to navigate somewhere after clicking the image like a normal LinkClick? Can you post the HTML you would expect to write to do this.
 

Byak@

Active Member
Licensed User
Do you expect to navigate somewhere after clicking the image like a normal LinkClick?
Yes!:sign0060:
for example
B4X:
<img src="cray1tn.gif" bordercolor="lime" border="1" width = "30" height="0" ignore="true" [COLOR=Red]href="#test"[/COLOR] name="Right image"/>
 

agraham

Expert
Licensed User
Longtime User
Sorry, I've looked at putting an href attribute in an img tag but it is too much work as the navigation is intrinsically bound up with the anchor tag handling. I would suggest that you do something like store the destination in the name attribute of the img tag and in MouseDown check if is is an image, retrieve the name and use the NavigateTo method.

So the next version will have added

1) ChangeColor(colorsymbol As String) method and five custom colors, color1 to color5 which default to cBlack

2) ItemTypeAt(X as Int32, Y as Int32), ItemNameAt(X as Int32, Y as Int32) and ItemTextAt(X as Int32, Y as Int32) methods which return the same data as ClickedItemType, ClickedItemName and ClickedItemText but for the specified XY position in the document.
 

Byak@

Active Member
Licensed User
Thanks))
and as i think i'm find a bug.VScrollMax return not true value.please check it.
and i'm can't hide scrollbars on device (on desctop all work right).i'm try 'HScrollVisible=false' and i'm try set this parametr with door lib.on desctop all work but on device none=((
 

agraham

Expert
Licensed User
Longtime User
VScrollMax return not true value.
In what way? It seems to be correct in the demo.

i'm can't hide scrollbars on device (on desctop all work right)
I can on my device but note that it doesn't work in App_Start on the device because the Form isn't drawn then. It only gets drawn after App_Start ends. On the desktop the undrawn ScrollBars seem to keep the Visible setting if set False in App_Start but on the device they appear to default to Visible when first drawn.
 
Top