PDA

View Full Version : Web browser in a form


ABC123

George Corder
02-23-2007, 01:09 PM
Richard's post (http://msgboard.alphasoftware.com/alphaforum/showthread.php?t=65577) gives a rundown on how to add a live web browser of Google maps and UPS tracking within a form on the desktop.

Filemaker 8.5 has a little more user friendly interface to this here (http://www.filemaker.com/products/fmp/web_viewer.html) along with a video (http://www.filemaker.com/eight_five/learning/pop_movie.html?src=T01_v1.mov).

Any plans on adding any of this ease of use to Alpha for this type feature? Just thought that some newer users may not want to get into the function creating.

Selwyn Rabins
02-23-2007, 08:42 PM
Richard's post (http://msgboard.alphasoftware.com/alphaforum/showthread.php?t=65577) gives a rundown on how to add a live web browser of Google maps and UPS tracking within a form on the desktop.

Filemaker 8.5 has a little more user friendly interface to this here (http://www.filemaker.com/products/fmp/web_viewer.html) along with a video (http://www.filemaker.com/eight_five/learning/pop_movie.html?src=T01_v1.mov).

Any plans on adding any of this ease of use to Alpha for this type feature? Just thought that some newer users may not want to get into the function creating.


Yes - we have some very big plans in this area - we are going to be adding the concept of 'super controls'. They will appear in the drag drop list. an example of a super control would be a 'ups traking page'. when you put a super control on a form a genie will pop up asking for configuration information. there will be no programming required of the user.

Doug Page
02-23-2007, 09:43 PM
Selwyn,

You are a god!

Thank you. Doug

George Corder
02-23-2007, 11:13 PM
Thanks Selwyn.

Digitaled
02-24-2007, 03:16 AM
super control would be a 'ups traking page'.

I could use that about right now..

G Gabriel
02-24-2007, 02:02 PM
When I first read this question and before any responses from anyone, I thought to myself: why can't alpha just devlop a layer between the user and the Activex and add more controls that you can drag and drop in design mode?

Well, what do you? according to Selwyn, that's what alpha intends to do. Great.

Of note, when I went to develop the web viewer following Richard's instructions, I found it very easy to do, now I moved all my bookmarks from Netscape & IE to alpha. Works great.

This is a very nice feature, one of my favorites so far.

I don't know how far out in the future Selwyn plans these super-controls, but for now, you could do your own for the most popular web pages and it really is very easy.

As an added bonus, when I moved all my bookmarks to a table in alpha, that table also has fields for login ID's & passwords so when you visit a page, you don't have to remember nor look for your ID/password. Talk about COOL! the script will load the ID/password (that's my hope at least). Will add few more fields for those stupid questions: your favorite pet name..etc.

Now, I am trying to work on a script that adds web pages to my table i.e. bookmark a page.

Digitaled
02-24-2007, 02:28 PM
Gabriel
If you get the (script will load the ID/password (that's my hope at least).
Working please share.

I have a password and ID and website tracker all ready made as i have so many passwords to so many web sites.

That would be a fantastic feature if you could just click on the web site link and it opens in a active X window and auto fills in the User name and Password.

Or if it just opens the web site in a active X window and then some how has a stay on top pop up giving you your User name and password so you can copy and paste it in.



When I first read this question and before any responses from anyone, I thought to myself: why can't alpha just devlop a layer between the user and the Activex and add more controls that you can drag and drop in design mode?

Well, what do you? according to Selwyn, that's what alpha intends to do. Great.

Of note, when I went to develop the web viewer following Richard's instructions, I found it very easy to do, now I moved all my bookmarks from Netscape & IE to alpha. Works great.

This is a very nice feature, one of my favorites so far.

I don't know how far out in the future Selwyn plans these super-controls, but for now, you could do your own for the most popular web pages and it really is very easy.

As an added bonus, when I moved all my bookmarks to a table in alpha, that table also has fields for login ID's & passwords so when you visit a page, you don't have to remember nor look for your ID/password. Talk about COOL! the script will load the ID/password (that's my hope at least). Will add few more fields for those stupid questions: your favorite pet name..etc.

Now, I am trying to work on a script that adds web pages to my table i.e. bookmark a page.

G Gabriel
02-24-2007, 05:14 PM
Ed:
I was working on this and as I went to try it on one of the bank accounts, and as would Murphy would have it, that website was not accessible.

I am going to do some more work on it soon and report. Also, although I don't use UPS that often, just for the heck of it, I will develop a little nugget for those who would like to use it. All it is, is just one more function.

jkukuda
02-24-2007, 10:22 PM
If your so inclined you might look at the following links, between them and Richards example you can accomplish a lot.
http://msgboard.alphasoftware.com/alphaforum/showthread.php?t=63926
http://learnalpha.com/WebBrowser.pdf

I wonder if Richard would be nice enough to put an example of how to use the documentcomplete function on a form that can be utilized by xbasic to determine the page is finished loading.

I have never been able to get the activex busy property to be recognized by xbasic. That would also tell me when the document has finished loading

Richard Rabins
02-25-2007, 12:54 AM
I will ask Dave McCormick at Alpha (who created the sample application with the web browser embedded on an Alpha Five v8 form) to look into doing this.

Richard Rabins
02-25-2007, 01:00 AM
fyi -- If you look at the attachment you will see this sample application ships with Alpha Five version 8. It is called "sunrise properties."

Thanks

jkukuda
02-27-2007, 01:50 AM
In interactive mode this works
?ClerkBrowserEngine:ACTIVEX1.activex.Busy
?ClerkBrowserEngine:ACTIVEX1.activex.ReadyState

but in xbasic this dosen't work
dim x as l
while x = .t.
x=ClerkBrowserEngine:ACTIVEX1.activex.Busy
end while

dim ready as n
while ready <> 4
ready=ClerkBrowserEngine:ACTIVEX1.activex.ReadyState
end while

Please find me an answer.

Cian Chambliss
02-27-2007, 03:18 AM
John,
By 'Doesn't work' do you mean:

1) produces an error message.

or

2) Never exists the loop.

If the answer is 1 - what is the error reported?
If the answer is 2 - if you add a ui_yield() call inside the loops (which allows windows to process messages that are in its queue, which might be required for some activex controls) - does the problem go away?

Thanks,
Cian Chambliss.

jkukuda
02-28-2007, 01:00 AM
by dosen't work I mean that it races thru the script without waiting for the screen to load. What I want is for xbasic to wait until the web page is loaded before continuing.
I tried UI_YIELD() and nothing changes.

Where are the docs on this stuff? How do you use it?
_A5ShowPropertyDialog()
_A5EventHandler

Selwyn Rabins
02-28-2007, 01:27 AM
by dosen't work I mean that it races thru the script without waiting for the screen to load. What I want is for xbasic to wait until the web page is loaded before continuing.
I tried UI_YIELD() and nothing changes.

Where are the docs on this stuff? How do you use it?
_A5ShowPropertyDialog()
_A5EventHandler

Why don't you post a copy of your application so that we can see your code and duplicate the problem.

You probably need to have the ActiveX control invoke the rest of your Xbasic script once the activeX is ready.

Selwyn Rabins
02-28-2007, 01:31 AM
by dosen't work I mean that it races thru the script without waiting for the screen to load. What I want is for xbasic to wait until the web page is loaded before continuing.
I tried UI_YIELD() and nothing changes.

Where are the docs on this stuff? How do you use it?
_A5ShowPropertyDialog()
_A5EventHandler

They are not documented. These methods are for internal A5 use. They are not really of any value to a developer. A5 add these methods to all activeX controls. The first one is used to open the ActiveX control's Property Dialog. I can't remember offhand what the second one does, and I don't want to call any of the programmers at 12:30 am to find out.

Digitaled
02-28-2007, 01:48 AM
I have the sunset property's sample all working in my program now and love it.

Have a few ?s
How can this be done.

I would like to add a button on the sunset property's form that will let me click on it and it will take my information from my (about my business) form and show me a map from my location to the current customer in the the sunset property's form in the map window.?

I would also on another tab like to have a way to bring up the weather web site all set up for my area based on my (about my business form) zip code.

And

Have the scripts that run the different web sits in a table or something? and let the end user go in to a set up area and pick defaults for the kind of shipping they use. So when they are in the sunset property's form it will be showing them UPS or Fedex for tracking..What ever they use.

I think their is an endless amount of possibility's for the ActiveX web browser in a Alpha program..

Any code for all that yet?

Cian Chambliss
02-28-2007, 06:16 AM
The example code posted doesn't have a pre-initialization - which means that x will be false (the default for logicals) and ready will be 0 (the default for numerics) - does changing the script to this help?

dim x as l
' properly initialize loop control variable
x=ClerkBrowserEngine:ACTIVEX1.activex.Busy
while x = .t.
x=ClerkBrowserEngine:ACTIVEX1.activex.Busy
end while

dim ready as n
' properly initialize loop control variable
ready=ClerkBrowserEngine:ACTIVEX1.activex.ReadyState
while ready <> 4
ready=ClerkBrowserEngine:ACTIVEX1.activex.ReadyState
end while

Tim Sutherland
02-28-2007, 07:13 AM
I would like to add a button on the sunset property's form that will let me click on it and it will take my information from my (about my business) form and show me a map from my location to the current customer in the the sunset property's form in the map window.?

Here's the url code we use to route between two addresses:



addr="http://maps.google.com/maps?q=from: " + trim(CT->Address1) + ", " + CT->Zip + " to: " + trim(Customer->Address) + ", " + Customer->Zip

jkukuda
03-01-2007, 01:04 AM
I've enclosed a demo of what I am trying to accomplish. The wait states make it work. I'm looking for a way to monitor when the web page is downloaded. I've not been able to get the busy and ready state properties to work. I don't know how to use the document complete function in the form.

G Gabriel
03-01-2007, 10:37 AM
John:
I put a message box in the downloadcomplete, and it fires.
I am not sure though, why do you need it?

jkukuda
03-01-2007, 02:29 PM
Your right, thats the only place I got a reaction. I got none under documentcomplete. All I am trying to do is find the proper way to determine when the page has downloaded and make my prog wait for it, instead of using the wait states. It would run much faster.

jkletrovets
03-01-2007, 04:08 PM
I haven't looked in depth at what you are doing but there is an Article on Dr. Wayne's site that might help. It is the Screen Scraping article. A snippet from this reveals he was having a similar issue. This is from the PDF on his site.


Although it worked, it clearly is not a satisfactory solution. First, it obligates a 5-second delay, even
when it isn't necessary; but more significantly, if Yahoo Finance is very busy or the internet connection
is very slow, then 5 seconds may not be enough. We need to know exactly when the document has
been completely downloaded. Oops – isn't that the definition of an event?
...Page 11 of 16

Just thought I would throw it out in case you might get something from the article. As I said, I have not looked at this myself - just pointing out the article in case you have not seen it.

Regards,

Jeff

jkukuda
03-01-2007, 05:34 PM
Yep, I provided that link earlier in this thread.

G Gabriel
03-01-2007, 06:41 PM
John:

All I am trying to do is find the proper way to determine when the page has downloaded
I am not sure that's feasible given that a web page might have more than one page (frame). To be able to know that the document completed downloading, you have to know that the last frame has downloaded. And given that those frames don't particularly downloan in any given order, you can't.

When I used the downloadcomplete, it fired several times which leads me to believe it fires every time a frame is done. That's just a guess on my part. Now, if that's correct, you could test each particular site and knowing how many frames are there and create a counter as a flag. Of course, you have to stay current with the web page.

This is my rudimentary work-around. Others might have a fancier solution.

jkletrovets
03-01-2007, 07:38 PM
Yep, I provided that link earlier in this thread.

Oops, sorry John I missed that.

Regards,

Jeff

jkukuda
03-01-2007, 08:26 PM
I have inserted the following code in the sample I posted.
The only thing that fires is download complete




function beforenavigate2 as v (pDisp as P,URL as P,Flags as P,TargetFrameName as P,PostData as P,Headers as P,Cancel as L)
ui_mas_box("Navagate2","Navagate2 Fired")
end function

function documentcomplete as v (pDisp as P,URL as P)
ui_msg_box("Congrats","Document Complete")
end function

function downloadcomplete as v ()
ui_msg_box("Congrats","DownLoad Complete")
end function

function navigatecomplete2 as v (pDisp as P,URL as P)
ui_msg_box("Congrats","Navagate Complete")
end function

G Gabriel
03-02-2007, 12:32 AM
John:
13597
I counted 2 to open the main page, 2 to open the following one, 2 more to get to the names and 1 or two for the last page. My count could be wrong because it moves a bit fast.

G Gabriel
03-03-2007, 08:41 AM
John:
For what's worth, I just read that article by Dr Wayne, in which he states:

"..Indeed, the message pops up four or five times. I don't know why navigatecomplete2 keeps iring, but it's probably related to the way Yahoo Finance's web page keeps updating itself; the event only fires once for simple, static web pages like www.learnalpha.com."

Maybe Dr Wayne could chime in here, but my thinking is, as I said earlier, I believe this event fires each time a frame finishes loading.

I will do some testing on web pages with one and more than one frame for confirmation.

G Gabriel
03-03-2007, 08:48 AM
Didn't have to go too far to find the answer, Here you go, hot off the grill:

NavigateComplete2 Event

Fires after a navigation to a link is completed on either a window or frameSet element.
Remarks
The document might still be downloading (and in the case of HTML, images might still be downloading), but at least part of the document has been received from the server, and the viewer for the document has been created.
This event clearly does not serve your purposes.

G Gabriel
03-03-2007, 08:52 AM
DownloadComplete Event

Fires when a navigation operation finishes, is halted, or fails.
Remarks
Unlike NavigateComplete or NavigateComplete2, which are fired only when a URL is successfully navigated to, this event is always fired after a navigation starts. Any animation or "busy" indication that the container needs to display should be connected to this event.
Each DownloadBegin event will have a corresponding DownloadComplete event.
..and that won't help either..

G Gabriel
03-03-2007, 08:55 AM
Gee Wiz !
I might be a little smarter than I thought I was! Check this out:

DocumentComplete Event

Fires when a document has been completely loaded and initialized.
Remarks
The WebBrowser Control fires the DocumentComplete event when the document has completely loaded and the READYSTATE property has changed to READYSTATE_COMPLETE. Here are some important points regarding the firing of this event.

* In pages with no frames, this event fires once after loading is complete.
* In pages where multiple frames are loaded, this event fires for each frame where the DownloadBegin event has fired.
* In the loading process, the highest level frame (which is not necessarily the top-level frame) fires the final DocumentComplete event.


So... You could use a counter as I suggested, or better, use the top frame as indicator..

Are we there yet?

jkukuda
08-14-2007, 01:18 AM
This code works on the busy property.
I don't know how or why but it works well.
I concluded that when you read the busy property and maybe all properties of the webbrowser you get its current state. You can't tell if its changed unless you read it again. Maybe it could be done better, but I just use it cause it works.



x=.t.
while x <> .f.
UI_YIELD()
x=actx.busy
end while