/ Forums / Advansys Formativ / Creating Solutions with Formativ / Syntax for webbrowser events
-
CreatorTopic
-
February 15, 2007 at 10:05 am #4323
What is the right syntax for writing event handlers for the webbrowser control? Can you give me an example?
-
CreatorTopic
-
AuthorReplies
-
February 15, 2007 at 7:15 pm #7821
Formativ use the TWebBrowser. If you have Delphi available then see the EmbeddedWB in Internet palette. The URL below shows some common methods:
http://www.cryer.co.uk/brian/delphi/twebbrowser/twebbrowser_methods.htmTo write webbrowser event handler in Formativ, we will suggest you to see the Events tab in the Object Inspector. You can drop a EmbeddedWB from Additional tab into your Form then select the EmbeddedWB, click Events tab in the Object Inspector. Double click any of the event (i.e OnDownloadBegin, OnDownloadComplete, etc) to generate the code.
Hope this helps.
Regards,
Advansys SupportFebruary 16, 2007 at 7:52 am #7825The instructions you’ve given – double-clicking on events in the Object Inspector – don’t work for me. When I double-click on an event, nothing happens. I’m running Creator 2.0.1 with GroupWise 7.0.1 on Windows XP Professional with IE 7. Any idea what I’m doing wrong?
February 18, 2007 at 2:35 pm #7823I am using Formativ Studio 2.0.1, GroupWise 7.0.1 (Build date: 14/12/2006) & IE 6. I will test with Creator and let you know the results. What is the build date of the GroupWise client (see Help – About GroupWise)?
Regards,
Advansys SupportFebruary 18, 2007 at 4:24 pm #7824I have tested with Formativ Creator 2.0.1 and it works fine. We have sent you an example Applet directly.
Regards,
Advansys SupportNovember 18, 2009 at 1:25 pm #7822I am trying to capture EmbeddedWB events but most of them I try never fire.
Am I missing anything that would make sure such events as OnNavigateError and OnNavigateComplete2 actually fire?
The only event I have been able to see fired is OnProgressChange.
Specifically, I am trying to create some code that will determine if the page I browsed using .Navigate was successful. i.e. not a page not found error.
[This message was edited by ctaleck on November 18, 2009 at 01:42 PM.]
November 19, 2009 at 3:45 pm #7826Our engineers confirmed the behaviour, we also noticed few other events also not fire. We are not sure what cause this events not to fire, potentially a low level component integration.
Given OnProgressChange events work, you can use the following workaround to determine page loaded successfully.
Note:
– Utilities.IHTMLDocumentFromViewHandle: See Formativ Language Guide for more information. This method return an instance of the IHTMLDocument2 interface obtained from the window.
– IHTMLDocument2 : http://msdn.microsoft.com/en-us/library/aa752574(VS.85).aspx
– Debugging Applet: http://www.advansyscorp.com/forums/topic/9151084651/dim gURLPrecossed Sub Main(Client, GWEvent) gURLPrecossed = false Maindlg.embeddedWB.navigate("www.advansyscorp.com") Maindlg.ShowModal End Sub Sub embeddedWBProgressChange(Sender, Progress, ProgressMax) utilities.trace("-> embeddedWBProgressChange gURLPrecossed: " & gURLPrecossed) utilities.doevents ' Event can fired more then once, we will skip if gURLPrecossed global variable ' is TRUE. Set gURLPrecossed to FALSE on loading page (i.e. Navigate() method). if (not gURLPrecossed) then ' Skip if engaged in a navigation or downloading operation. if (Maindlg.embeddedWB.Busy) then utilities.trace("-> embeddedWBProgressChange embeddedWB.Busy") exit sub end if dim oDocument if Utilities.IHTMLDocumentFromViewHandle(Maindlg.Handle, oDocument) = 0 then utilities.trace("-> embeddedWBProgressChange oDodument.title: " & oDocument.title) if ((Instr(1, oDocument.title, "http 404 not found", vbTextCompare) > 0) or (Instr(1, oDocument.title, "cannot find server", vbTextCompare) > 0)) then utilities.trace("-> embeddedWBProgressChange 'Page not found'") else utilities.trace("-> embeddedWBProgressChange Page loaded") end if gURLPrecossed = true else utilities.trace("-> embeddedWBProgressChange 'No handle'") end if set oDocument = nothing end if utilities.trace("<- embeddedWBProgressChange") End Sub
Hope this helps.
Regards,
Advansys Support -
AuthorReplies
- You must be logged in to reply to this topic.