[Project_owners] Two questions

Jaap Haitsma jaap at haitsma.org
Mon Aug 2 09:36:23 EDT 2004


Tracy Norris wrote:
> Can anyone out there answer a couple of questions.
> 
> 1. I've noticed that "global" variables in javascript are only global to 
> the xul file they are imported into (appearantly). Is there a way to 
> pass information back to a parent xul when displaying a child dalog? For 
> instance if I have this code:
> 
> function setPassword() {
>     
> window.openDialog("chrome://autofill/content/autofill_set_password.xul","autofill_set_password","chrome");
> }
> 
> which is called when a button is clicked in the preferences dialog. How 
> do I pass the value entered in a textbox in the autofill_set_password 
> dialog back to the preferences dialog  and store it in a global variable 
> there? I've noticed some references on xulplanet which tell me how to 
> set a xul element in the parent dialog, but not a java script variable.


Take a look at 
http://www.mozdev.org/source/browse/reloadevery/src/content/reloadevery/

warnPostData is a dialog that is launched from the main app and the data 
that's filled in there is saved in the main app

> 2. Does anyone know how to have a dialog open centered within the window 
> (or dialog) that opened it? For instance, in the example above , the 
> resulting dialog opens in the upper left hand corner of the screen.. I'd 
> like it to open in the center of the prefences dialog.

If it's possible there should be a keyword you can add to window open 
dialog. For example if you add centerscreen to the option chrome it 
opens in the center op the screen.

Hope this helps

Jaap


More information about the Project_owners mailing list