Ali, Mazin wrote:
Hi
I'm trying to intercept combo box select. here is my code, but the event never fire when I select new item from the combo box.
anyone can help me in this one.

nsCOMPtr<nsIDOMHTMLSelectElement> SelectElement = do_QueryInterface( pNode, &rs );

nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(SelectElement) ;

nsCOMPtr<nsIDOMEventListener> eventListener = new sinkevent(this);

target->AddEventListener(NS_LITERAL_STRING("select"),eventListener,PR_TRUE) ;

The only difference I see between your AddEventListener () function and mine is that I use 'false' for the last parameter of that function. However, I think how you are implementing this is quite a bit different than how I am. I implemented the nsIWebBrowserChrome object, then thru the ::OnStateChange () function I find out when my web page has completely loaded and then I do all my event sinks for the events I want...

I first get an nsIDOMWindow from aWebProgress->GetDOMWindow () (aWebProgress is passed to the ::OnStateChange () function), then I get an nsIEventTarget by querying my nsIDOMWindow I just got. After I have my nsIEventTarget, I then use nsIEventTarget::AddEventListener () to add all my events..

Here is what that part looks like
rv = pCOM_det->AddEventListener (nsString (L"select"), this, false);
Have you tried the "change" event yet?

Here is a link to some Gecko Embedding docs, not sure if you have come across it, but it has some good information in it.

http://www.mozilla.org/projects/embedding/embedoverview/EmbeddingBasics13.html

I haven't been working with this API for very long, I'm sure there are much more experienced developers out there that could tell you if your methodology is sound. I hope this helps.

Niky Williams

_______________________________________________
mozilla-embedding mailing list
mozilla-embedding@mozilla.org
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to