Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MS Browser Control - get parent object
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01508069
Message ID:
01508741
Views:
66
Likes (1)
What are you doing exactly? If you need to capture those document events then you need to implement the event interface in FoxPro. To get a reference to the document object you need to pass in a reference either to the form or the document on the event object so it can see those instances.

It's not that easy, but here's what I do: I have an MSHTMLEventBase class that has properties on it for the document object and parent window. The event class

Inside the event you should be able to do:
DEFINE CLASS MSHtmlEventBase as RELATION
   oDoc = null

   DIMENSION aDocumentMap[1,1] 
   lShowDocumentMap = .F.
   
************************************************************************
* MSHtmlEventBase :: GetEventObject
****************************************
***  Function:
***    Assume:
***      Pass:
***    Return:
************************************************************************
FUNCTION GetEventObject()

IF ISNULL(THIS.oDoc)
   RETURN .NULL.
ENDIF

RETURN this.oDoc.ParentWindow.Event
ENDFUNC

ENDDEFINE
Then implement your event class as exported:
DEFINE CLASS IHtmlTextContainerEvents AS MSHTMLEventBase OLEPUBLIC
   IMPLEMENTS HTMLTextContainerEvents IN "MSHTML.TLB"

...

ENDDEFINE
Then when you bind the event with BINDEVENTS you can explicitly assign the document object to the event handler so it can get a reference to the event object.

BINDEVENT(loBrowser.Document,loHtmlEventInterface)
loHtmlInterface.oDoc = loBrowser.Document


Then in the click handler (or any other event):
*** Get Event object
loEvent = this.GetEventObject()

 ? loEvent.keyCode
? loEvent.button && 0 left 2 right 1 middle
+++ Rick ---



>Rick,
>I know I must be missing something here. Since there is no click event or mouse down event in the browser control I was trying to trap for those using
HTMLDocumentEvents_onclick()
from your white paper. That was where the wait window error was coming from.
>
>So, how do I read a property and send it to my program when the user clicks on the browser control? I can have any number of browser controls on a form and I need to know which one they selected so I can set the HTML for that one.
>
>Thanks,
>John
>
>
>>The parent object should work. Just make sure you call it (and just about any other document properties) after the document has completed loading...
>>
>>+++ Rick ---
>>
>>>I have worked out almost all my problems with the blasted browser control. However I have a number of the controls within a number of different containers and when the user clicks on a browser control I can't find a way to determine which one was clicked on. The browser control just crashes with the code
WAIT WINDOW THIS.PARENT.NAME
. .Parent does not work.
>>>
>>>I found I can add the parent object as a property to the browser object. Now, how do I read it???
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform