> You can get even more tricky by creating a js object in the code
> preceeding the window.openDialog() call, and then you dont have to worry
> about the order of the arguments:
> 
> foo={
>    apple : "red",
> banana: "yellow",
> orange: "green"
> }

Yep, agree. Passing around objects is way handy. 

--pete



> then call
> window.openDialog("chrome://my/package/content/foo.xul",foo)
> 
> Then in the dialog you can always just use:
> 
> window.arguments[0].apple;
> or
> window.arguments[0]['banana'];
> 
> I ran into this problem with aim code.  It's a pain to do it the other way because 
>you always
have to make sure you keep the order of the arguments right, and if you
want to add a new
argument, you have to add it to all the callers of that openDialog, lest
someone else add a new
argument and not know they need a placeholder for your new argument :)
> 
> Brian King wrote:
> 
> > You can pass a limitless (I think) number of arguments when opening a
> > dialog like follows:
> >
> > XUL
> > window.openDialog("chrome://my/package/content/foo.xul",
> >    "fooDialog",
> >     "chrome,dialog=yes,close=no,modal=yes",
> >     var1,
> >     var2
> >     var3);
> >
> > and get at them in script:
> >
> > JS
> > var one = window.arguments[0];
> > var two = window.arguments[1];
> > // ...
> >
> > - Brian
> >
> > Daniel Howe wrote:
> >
> >> Hi all,
> >> I need to pass a variable to a modal window, so that when it opens some
> >> of the user prefs are pre-filled. A similar example is the CookieViewer
> >> window - if I needed to open that window with the fields for one cookie
> >> pre-filled & I had the id for that cookie, how could I do this? Any help
> >> would be great...
> >> Thanks much,
> >> /daniel
> >

Reply via email to