BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Events in TWebbrowser-Elements?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Norman Czarczinski
Guest





PostPosted: Wed Aug 02, 2006 2:17 pm    Post subject: Events in TWebbrowser-Elements? Reply with quote



Hi,
I use a TWebbrowser (EmbeddedWB) to show a HTML-Page with formular
elements. Now I want implement events that signals me when the users
modify values so I can later make a submit-call.

In the DocumentComplete-event I try following code to get events from
all elements for testing:

doc := htmText.Document as IHTMLDocument2;
iDisp := doc.all;
if assigned(iDisp) then
begin
iDisp.QueryInterface(IHTMLElementCollection, iColl);
if assigned(iColl) then
begin
for i := 0 to iColl.Get_length-1 do
begin
iDisp := iColl.item(i, 0);

iDisp.QueryInterface(IHTMLElement, HTMLElement);
if Assigned(HTMLElement) then
begin
ElementEvents := TMSHTMLHTMLElementEvents.Create(Self);
ElementEvents.Onxxxx := ...
ElementEvents.Connect(HTMLElement);
end;
end;
end;
end;

After a few elements I get an unsupported interface error into the
connect method because the FindConnectionPoint fails. How can I avoid
this and check if a HTMLElement has a HTMLElementEvent-ConnectionPoint?
And why not all HTMLElements have a HTMLElementEvent-ConnectionPoint?

At next I try to get only events from input-elements, but use the basic
HTMLElementEvent (later I want to pool this components):

...
for i := 0 to iColl.Get_length-1 do
begin
iDisp := iColl.item(i, 0);

iDisp.QueryInterface(IHTMLInputElement, HTMLInputElement);
if Assigned(HTMLInputElement) then
begin
iDisp.QueryInterface(IHTMLElement, HTMLElement);
ElementEvents := TMSHTMLHTMLElementEvents.Create(Self);
ElementEvents.Onxxxx := ...
ElementEvents.Connect(HTMLElement);
end;
end;
...

Now it fails for all elements. After the QueryInterface to test for a
IHTMLInputElement the FindConnectionPoint finds no HTMLEventElement. Why
was it destroyed?

How can I get correctly events for textboxes, checkboxes, radiobuttons
and selection-elements?

Bye, and TIA
Norman
--
|\ _,,,---,,_ Norman Czarczinski
/,`.-'`' -. ;-;;,_
|,4- ) )-,_..;\ ( `'-'
'---''(_/--' `-'\_) fL
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.