Web browser for desktop and device

agraham

Expert
Licensed User
I had previously tried to wrap a .NET WebBrowser in a B4PPC library but for technical reasons to do with threading this would not work on the desktop in previous versions of B4PPC. As of version 6.05 Erel has changed the threading model of the B4PPC desktop so I can now offer this library and help file.

As stated this requires B4PPC version 6.05 or later and .NET 2.0. It will work on both device and desktop.

EDIT :- Version 1.1 replaced version 1.0. See post #14 in this thread for the changes.

EDIT : - Source 1.1 code for dll merging posted. Put it in the Basic4ppc Desktop\Libraries folder.

EDIT :- Version 1.2 posted with source. This version is AutoScale aware. See post #53
 

Attachments

Last edited:

alfcen

Well-Known Member
Licensed User
Hi Andrew,
Looks really great. Thanks so much, indeed !
Just a small finding,

web.IsOffline causes a "NotSupportedException" error on the device

B4X:
Sub CheckOffline
  If hc.IsOffline Then
    Msgbox("Device is offline."," Tenki",cMsgBoxNone,cMsgBoxAsterisk)
  End If
  Return hc.IsOffline
End Sub
Would it be a great effort to add methods to influence font size and
text wrapping?

Cheers
Robert
 

agraham

Expert
Licensed User
web.IsOffline causes a "NotSupportedException" error on the device
Sorry. it must be an error in Microsofts' documention! It is documented as being available on the device.

Would it be a great effort to add methods to influence font size and text wrapping?
Not possible (on the device at least). The device WebBrowser is a very small very simplified subset of the desktop version. I've been throuugh the docs again but can't see anything else useful to implement.
 

alfcen

Well-Known Member
Licensed User
Fair enough. That does not diminish your great efforts.
No problem, I can work around it.
Regarding font size, etc., I thought it was possible because dzt's
htmlview.dll can do it(?)
 

agraham

Expert
Licensed User
Regarding font size, etc., I thought it was possible because dzt's htmlview.dll can do it(?)
I think that you must be referring to the zoom level in dzHtmlView, that is the only manipulation that I can see that it offers. He can do that because he is not using the .NET control but going in to the underlying native control at a very low level by hooking the window procedure and watching/sending window messages. Apart from the occasional native dll call I prefer to work at a rather higher level in .NET and these low-level operations are not exposed there.
 

alfcen

Well-Known Member
Licensed User
Forgive my naiveness, I have no experience in programming on levels lower than BASIC. Thanks a lot for your comprehensive explanation.
 

berndgoedecke

Active Member
Licensed User
How to get the url from the href-"tag"

Hello agraham,
is it possible to get the url from the href -"tag" before it is excecuted by the browser?
At the dzHTMLViewLib is the onhotspot event to do this. It's a nice event, even if you use basic commands instead of url, for href setting.
Should it be that ControlRef returns this data ?

Best regards

berndgoedecke
 

agraham

Expert
Licensed User
is it possible to get the url from the href -"tag" before it is excecuted by the browser?
I know very little about html. Show me the code of how to do this with dzHtmlView and I will see.

The ControlRef property returns a reference to the underlying WebBrowser control and would only be of use to pass to another library that understood a .NET WebBrowser. You can't do anything with it in B4PPC.
 

berndgoedecke

Active Member
Licensed User
Read out table values or properties by using href.

Hello agraham,
I create a table in this way:
For i = 0 To SelSpAnz-2
HtmStr = HtmStr & "<tr>" & crlf
HtmStr = HtmStr & "<td " & Chr(34) & "width=33%" & Chr(34) & " style= " & Chr(34) & "white-space:normal" & "; " & "background-color:#E0E0E0" & Chr(34) & ">" & "<a href='" & SelSpNam(i) & crlf & reader.GetValue(i)& "'>" & SelSpNam(i) & "</a></td>" & crlf
HtmStr = HtmStr & "<td " & Chr(34) & "width=67%" & Chr(34) & " style= " & Chr(34) & "white-space:normal" & "; " & "background-color:#FFFFFF" & Chr(34) & ">" & reader.GetValue(i) & "</td>" & crlf
HtmStr = HtmStr & "</tr>" & crlf
Next

The href-statement "<a href='" & SelSpNam(i) & crlf & reader.GetValue(i)& "'>"
is used by the onhotspot event in this way:

Sub hc_OnHotSPot
DTemp = hc.EncodeUTF8(hc.Url)
TempArr() = StrSplit(DTemp,crlf)
Msgbox("Ausgewählt: " & crlf & "ColumnName: " & TempArr(0) & crlf & "Data: " & TempArr(1))
End Sub

So I can locate the datas in the table or the position or whatever. Dzhtmlview is doing it verry nice but your HTMLBrowser supports some more tags to formate the table, so it would be great to use it in the same way.
I hope this codelines will help you to undestand what my problem is. It would be very helpfull to combinate the very good HTML-compatibility with the onhotspot event or somthing like that.

Best regards
berndgoedecke
 

agraham

Expert
Licensed User
your HTMLBrowser supports some more tags to formate the table, so it would be great to use it in the same way.
I am surprised because I thought that both my WebBrowser and dzHtmlView were using the same underlying browser.

I have replaced the original download with a new version 1.1 with amended help file and amended demo apps that hopefully do what you want. The following new things have been added. I didn't add them originally as I didn't realise they might be useful.

DocumentText - a write-only property to set the html text of the browser. There is no way to access the text of the browser when either set by this property or downloaded.

CancelNavigate - a write-only property that cancels navigation if set true during a Navigating event. This property does not work on a device running WM2003.

NavigatingURL - a read-only property that when accessed within or after a Navigating event returns the URL to which the page is navigating. This property returns "Unavailable on WM2003" on a device running WM2003.

Navigating : an event that occurs when the control is starting to navigate to a new web page.

Navigated : an event that occurs when navigation to the new page is complete and and the browser is about to load and display the page.
 

jonjunhobbes

New Member
Licensed User
Agraham,

Thanks for your effort with this library, it works almost perfectly with a little app that I have; I had originally used dzt's similar library but a like some of the other functionality of yours. The one question I do have relates to the way it acts when viewing web pages that are written for pc's(vs. mobile sites). It looks to me like it automatically formats the page for "one column", like PIE does when you set it. Is there any possible way to view it similar to the "desktop" view on PIE? I tried using a panel with a scrollbar but it still formats to basically fit the screen. Thanks for any help you can offer.
 

agraham

Expert
Licensed User
Ianother option in the DLL or a different (/older) webbrowser.DLL for older Pocket PCs that I should be using?
From the help "NavigatingURL : String : When accessed within or after a Navigating event returns the URL to which the page is navigating. This property returns "Unavailable on WM2003" on a device running WM2003." Sorry but this is an OS limitation. There is no work around except to use WM5.0 or later.


In the CHM it says (c) "Andrew Graham - 2008" - is this you agraham ? :)
:sign0162:
 
Top