WebBrowserEX

Cableguy

Expert
Licensed User
Longtime User
WebBrowserEX 2.1

WebBrowserEX.DLL

This is an evolution of Andrew Graham's WebBrowser control library.

It enables a few new properties and methods that were not available in previoue releases.

All of the previous properties, methods and events are still present, so this will focus on the new ones aded to the base dll.




properties:


DLLVersion - Returns the Dll Version Number.
In this case it wil, return "2.1" as it is based in Andrews "1.0" WebBrowser DLL.

DocumentText - Can now GET current document text(html)

ScrollBars - Boolean, sets or gets wheter the scrollbars are visible or not

FocusedControlName - String, gets the name of the WebBrowser Document Controls that has the focus...
Can be used to learn the name of textboxes in a webForm, for later filling...

FocusedControlID - String, gets the ID of the WebBrowser Document Controls that has the focus...
Can be used to learn the name of textboxes in a webForm, for later filling...

ControlValue - String, sets or gets the value of the focused control

SupressScriptErrors - Boolean, Enables or disable the script error catching by the browser NEW

ContextMenuEnabled - Boolean, Enables or disables the Browser context menu NEW


methods:

Cookie - Retrieves the current document cookies...NEW

SendControlClick(String ID) - Fires the click event (if supported) of the specified control (either by ID or by Name)
Can be used to trigger a webform "submit" button instead of using the POST method

SetControlFocus(String Control) - Sets the focus to the specified webBrowser document based control, such as a textbox, either by ID or by name

Refresh() - Reloads the current url

Zoom(int factor) - Optical Zoom, as in IE7...


Most of these properties, methods and events work on any platform, BUT some are, as earlier referred by Andrew, not available in some OS versions, Other throw an error, and others are only available in the desktop, like the zoom feature.

I haven't tryied this in a device, because i do not have mobile data access enabled in my Universal.
Edit:
It is safer to say that this is a DESKTOP ONLY dll.


This is still a work in progress, so more properties, methods or events can be added, as needed and as possible.
Use this thread to post your opinion or suggestion for future versions.

Better demo file Uploaded, enjoy!!
 

Attachments

  • WebBrowserEX-Demo.sbp
    3 KB · Views: 275
  • Browser.zip
    7.3 KB · Views: 274
  • Browser.cs.txt
    14.3 KB · Views: 211
Last edited:

tsteward

Well-Known Member
Licensed User
Longtime User
Ok giving your browser library a try and I get an error when I try to compile.
See attached screen dump.
 

Attachments

  • Capture.PNG
    Capture.PNG
    16.2 KB · Views: 36

agraham

Expert
Licensed User
Longtime User
A few Objects apear in the object menu, but only the webbrowser object is to be added.The others are internal dll object that needed to be public
You can hide them by prepending an underscore to their names "_MyBrowser", "_OLECMDID" etc. B4ppc will not then show them as objects.
 

Cableguy

Expert
Licensed User
Longtime User
Thanks for the hint...
I have managed to hide the remaining objects from b4ppc...
I will release the new file with a new update...
I'm hopping to add a "links collection" array to the dll, so to list all the links present in a html document...
 

tsteward

Well-Known Member
Licensed User
Longtime User
I am considering useing your lib on the desktop version of my program.

Since with this lib you can get DocumentText. Is it possible to create a search feature to find some text then highlight it and scroll to make it visible?

Easy done with a text box but not sure with this lib.
 

Cableguy

Expert
Licensed User
Longtime User
I am considering useing your lib on the desktop version of my program.

Since with this lib you can get DocumentText. Is it possible to create a search feature to find some text then highlight it and scroll to make it visible?

Easy done with a text box but not sure with this lib.

Yes it is possible except for the auto scroll(yet)...
1st get the text with documenttext
2nd treat the resulting string as you normaly would do to serach for the word(s) you want
3rd Insert the needee html code to highling the word(s)
4rth show the resulting string using agian the document text

'll try to work out how to auto scroll to the highlighted word..
 

tsteward

Well-Known Member
Licensed User
Longtime User
A few questions if you don't mind.
When adding objects I notice you have

IWebBrowser2
MyBrowser
WebBrowser

Whats the differance? What are they for?

Also in your test file line 20:
B4X:
MyBrowser.FocusControl("Button")
I notice "FocusControl" is not in the popup list when using the IDE?

And I cant compile with your library. I cant even compile your test file for the desktop. Will this be fixed soon?
 
Last edited:

Cableguy

Expert
Licensed User
Longtime User
whch demo file are you using?
The WebBrowserDemo.spb is much complete and targets the current dll...
The Objects, as pointe in one of my posts, are public methods created in the dll, for internal use...
The next release of the dll, will only make public the Wbbrowser Object, That IS the one object to use.

Also I had NO problem compiling in either the Optimized compile or legacy compile...WITH THE WEBBROWSERDEMO.SPB FILE...
 
Last edited:

Byak@

Active Member
Licensed User
Greating Cableguy!what about creating new webbrowser for device?with programing scroll and zoom and edited contextmenu?
 

Cableguy

Expert
Licensed User
Longtime User
This Dll has beeen updated...
Version 2.1 available in the first post...
2 new props, SupressScriptErrors and ContextMenuEnabled, 1 new method, Cookie...
Enjoy
 

Cableguy

Expert
Licensed User
Longtime User
Mergeable cs file posted in post #1... remove the .txt from the file name and copy the file to the libraries folder...
 

agraham

Expert
Licensed User
Longtime User
Greating Cableguy!what about creating new webbrowser for device?with programing scroll and zoom and edited contextmenu?
I don't think that a new WebBrowser for the device will happen. If I'm not willing to tackle it (and I'm not!) I don't think anyone else around here can/will. However for formatting text on the device, and desktop, please try this possible solution http://www.b4x.com/forum/additional-libraries/3955-htmlpanel-rich-text-device.html#post22886 and give some suggestions for improvement.
 

Byak@

Active Member
Licensed User
Hello Cableguy. what about adding methods to control ScrollBars? as HScrollValue/VScrollValue. and event Scrolled
and what about method to set contect menu as FormLib contextmenu object? it will be very good!

_________________________
i'm read msdn...it is not possible =(((

and i can't find Shrink property o_O.OK,who know html?how can i do "shrink" with html?
 
Last edited:

Byak@

Active Member
Licensed User
i'm not understand...

i'm create a new object WebBrowser.add DocumentText
B4X:
<html>
<input name="textbox" value="" type="text">
</html>
(code1)
now i input some text to 'textbox' and get DocumentText.But i'm get code1! 'value' is empty!
why?
i'm try focuse 'textbox' and get ControlValue but have a empty string!i can set ControlValue.But if i now get controlvalue i have empty string too.
 
Last edited:

Cableguy

Expert
Licensed User
Longtime User
i'm not understand...

i'm create a new object WebBrowser.add DocumentText
B4X:
<html>
<input name="textbox" value="" type="text">
</html>
(code1)
now i input some text to 'textbox' and get DocumentText.But i'm get code1! 'value' is empty!
why?
i'm try focuse 'textbox' and get ControlValue but have a empty string!i can set ControlValue.But if i now get controlvalue i have empty string too.
HUM... In your example code "value" is EMPTY...(?)
Can you please post a sample file?
To focus you must Know or set the html name tag for the control, or the control ID, Both are html tags, so first try to explore the html code...
For exmaple, My dll2date "Program wannabe", uses these props to fill a username and password field in a form, using those same methods, but for the username control, I had to tweak the html to "force2 a name tag for the control.
 

Byak@

Active Member
Licensed User
emm...i'm post code =)

Code:
<html>
<input name="textbox" value="" type="text">
</html>

now value is empty but when i'm input text or set value it is not empty...but property return a clear string
 
Top