Web browser for desktop and device

Discussion in 'Additional Libraries' started by agraham, Feb 28, 2008.

  1. agraham

    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
     

    Attached Files:

    Last edited: Jun 10, 2009
  2. PepSoft

    PepSoft Member Licensed User

    Msg Error

    In my computer it appears a message of error.

    PepSoft
     

    Attached Files:

  3. Erel

    Erel Administrator Staff Member Licensed User

  4. PepSoft

    PepSoft Member Licensed User

    Thanks Erel.
    Excuse me, I forgotten to install version 6.05.
     
  5. alfcen

    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

    Code:
    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
     
  6. agraham

    agraham Expert Licensed User

    Sorry. it must be an error in Microsofts' documention! It is documented as being available on the device.

    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.
     
  7. alfcen

    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(?)
     
  8. agraham

    agraham Expert Licensed User

    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.
     
  9. alfcen

    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.
     
  10. agraham

    agraham Expert Licensed User

    Nothing to forgive - keep on asking then everyone learns (including me when I have to investigate something for a reply :) )
     
  11. berndgoedecke

    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
     
  12. agraham

    agraham Expert Licensed User

    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.
     
  13. berndgoedecke

    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
     
  14. agraham

    agraham Expert Licensed User

    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.
     
  15. jonjunhobbes

    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.
     
  16. agraham

    agraham Expert Licensed User

    I am afraid not. There probably is lower down somewhere as the .NET browser merely wraps the one used by PIE. However the functionality exposed in .NET does not include this.
     
  17. jonjunhobbes

    jonjunhobbes New Member Licensed User

    Good enough. Thanks for the reply.
     
  18. agraham

    agraham Expert Licensed User

    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.


    :sign0162:
     
  19. agraham

    agraham Expert Licensed User

    Source code for dll merging posted in first thread.
     
  20. Cableguy

    Cableguy Expert Licensed User

    Any chance to include either scrollbars, or zoom fuction, or even both?
     
Loading...