Hi,
Niky is right, you have to be sure your document has fully loaded. But
if it is not, you cant get he select element, at least if you use
FindElementById(). Try to listen for another event, fo example
"mouseover" or "click" to see if the event listener gets any events, so
you isolete the problem. Also, try to intercept the "select" event form
javascript to see when the event is fired etc. Altogether, you cn use
javascript for prototyping, and when it works, implement it in C++.
Regards
Alex
Niky Williams wrote:
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
_______________________________________________
mozilla-embedding mailing list
mozilla-embedding@mozilla.org
http://mail.mozilla.org/listinfo/mozilla-embedding