I noticed these events (nsIDOMxxxEvent) yesterday but had no idea how I could register my application to listen to them. I have an instance of nsIWebBrowser and nsIWebBrowserChrome. Using queryInterface I can get browser chrome's nsIBaseWindow - but none of these classes has any method like addEventListener() or something like this.

As for browser scrolling - I don't need to receive scrolling events (may be need them later), but want the browser to react on them itself. For example, if I click a link inside a browser, it follows that page automatically without any actions in my code, but for scrolling this is not a case. Do I need to listen to key/mouse events myself and then tell the browser to perform what I need?

If you can send me some short example it would be fine. Also, don't you know is there any tutorial about mozilla UI (windows, widgets, events, etc.) available? All I can find in the web is descriptions of Mozilla interfaces, not how to use them together:(

Thanks,

Artem

Niky Williams wrote:

Artem Ananiev wrote:

I'm embedding Mozilla-based browser into my Java application using JavaXPCOM, on Windows. One of the first difficulties I met is that browser doesn't react on mouse wheel, thoug its scrollbar is present. My container implements these interfaces: nsIWebBrowserChrome, nsIWebBrowserChromeFocus, nsIEmbeddingSiteWindow. What should I do to enable mouse wheel in embedded browser?

Another question is: is it possible to get mouse and key events occuring in browser? I don't need them right now but they can be useful in my app later.

Thanks,

Artem


Artem,
I'm not real familiar with Java, but to receive events in my C++ app, I implement the nsIDOMEventListener interface. You have to setup the events you want notification from for this to work, but it's not that hard. If you get to the point you need code examples, I can provide you some in C++.

If you want to DISPATCH key or mouse events to an element, take a look at:
nsIDOMDocumentEvent
nsIDOMEvent
nsIEventTarget
nsIDOMKeyEvent
nsIDOMMouseEvent

Again, if you need some code examples, I can provide you with a few.

Hope this helps!

Nik Williams

_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to