Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Window watcher

5 views
Skip to first unread message

Tom

unread,
Oct 21, 2006, 4:23:28 PM10/21/06
to
How do get the window object from an XPCOM Component? I want to create a
window capture events and set the position and location of the window. Iw as
using the window watcher to create the window - however it seems I do not
have control. The following code bombs when it get to the resizeTo command.

var url =
Components.classes["@mozilla.org/supports-string;1"]
.createInstance(Components.interfaces.nsISupportsString);
url.data = aUrl;

var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Components.interfaces.nsIWindowWatcher);


var theWindow = ww.openWindow(null, "chrome://browser/content/browser.xul",
"_blank",
'chrome,dialog=no', url);


theWindow .resizeTo(g_width, g_height);
theWindow .moveTo(g_xPos, g_yPos);


Neil

unread,
Oct 22, 2006, 8:38:41 AM10/22/06
to
Tom wrote:

>var theWindow = ww.openWindow(null, "chrome://browser/content/browser.xul", "_blank", 'chrome,dialog=no', url);
>theWindow .resizeTo(g_width, g_height);
>theWindow .moveTo(g_xPos, g_yPos);
>
>

I'm not sure that it's possible to resize and move a window immediately
after it's been created, you might try waiting for it to load first.

--
Warning: May contain traces of nuts.

Tom

unread,
Oct 22, 2006, 11:50:03 AM10/22/06
to

"Neil" <ne...@parkwaycc.co.uk> wrote in message
news:IYmdnSCPtf7I-6bY...@mozilla.org...

> Tom wrote:
>
>>var theWindow = ww.openWindow(null,
>>"chrome://browser/content/browser.xul", "_blank", 'chrome,dialog=no',
>>url);
>>theWindow .resizeTo(g_width, g_height);
>>theWindow .moveTo(g_xPos, g_yPos);
>>
> I'm not sure that it's possible to resize and move a window immediately
> after it's been created, you might try waiting for it to load first.
>

I discovered what the issue was! I changed the openWindow call to

ww.openWindow(null, url, 'Title of Window', features, null);

Once I did that I was able to add events handlers and control the window. So
it must of been an issue with using the browser XUL. Hmmm? Interesting!

bruceb...@gmail.com

unread,
Oct 23, 2006, 6:56:53 AM10/23/06
to
Sorry to hijack your thread, but does anybody have a list of events
that can be fired by a window? Specifically, I'm interested in the
event fired when a window is focused. Also, by window does FF mean the
Firefox window or the browser window (possibly a tab)? I want to
receive notification when the FF window is focussed, so I can switch
tab.

0 new messages