Tomasz Pyra napisał(a):


Yes, but how to dispatch a click?
nsIDOMHTMLAnchorElement and his base clases do not have such method (or I don't searched enough).
I found only Focus() and Blur(), but I think it is not enough.

I tried that way: (linkHTMLElement is my <a> tag - type nsIDOMHTMLAnchorElement)




nsCOMPtr<nsIDOMDocument> OwnerDoc; linkHTMLElement->GetOwnerDocument(getter_AddRefs(OwnerDoc));

nsCOMPtr<nsIDOMDocumentView>doc = do_QueryInterface(OwnerDoc);

nsCOMPtr<nsIDOMAbstractView> view;
doc->GetDefaultView(getter_AddRefs(view));

                        
nsCOMPtr<nsIDOMDocumentEvent>docEvent(do_QueryInterface(OwnerDoc));

nsCOMPtr<nsIDOMEvent>linkClickEvent;
docEvent->CreateEvent(NS_LITERAL_STRING("MouseEvents"),getter_AddRefs(linkClickEvent));



nsresult result;
nsCOMPtr<nsIDOMMouseEvent> mouseEvt= do_QueryInterface(linkClickEvent,&result);


mouseEvt->InitMouseEvent(NS_LITERAL_STRING("click"),PR_TRUE,PR_TRUE,view,0,0,0,0,0,PR_FALSE,PR_FALSE,PR_FALSE,PR_FALSE,1,nsnull);

nsCOMPtr<nsIDOMEventTarget> evtTarget= do_QueryInterface(OwnerDoc,&result);

PRBool clickStatus;
evtTarget->DispatchEvent(mouseEvt,&clickStatus);

TRACE("clickStatus=%d\n",clickStatus);




After all clickStatus=1 (is that good?). QuerInterfaces result's are zeros (good). So everything looks good, but nothing happends... _______________________________________________ mozilla-embedding mailing list [email protected] http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to