Re: printdialog error

"William JOYE" <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xpcom
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
OK. Now, I would like to call xull with the openDialog function and the 2
parameters but and I cannot create them correctly.
How can I create the 2 arguments (nsIPrintSettings object and the container
for return value)? Here is the parameters and a few code
...
// param[0]: nsIPrintSettings object
// param[1]: container for return value (1 = print, 0 = cancel)
var ps = window.arguments[0].QueryInterface(gPrintSetInterface);
if (ps != null) {
gPrintSettings = ps;
paramBlock =
window.arguments[1].QueryInterface(Components.interfaces.nsIDialogParamBlock
);
} else {
var suppsArray =
window.arguments[0].QueryInterface(Components.interfaces.nsISupportsArray);
if (suppsArray) {
var supps = suppsArray.ElementAt(0);
gPrintSettings = supps.QueryInterface(gPrintSetInterface);
if(!gPrintSettings) {
return;
}
supps = suppsArray.ElementAt(1);
paramBlock =
supps.QueryInterface(Components.interfaces.nsIDialogParamBlock);
if(!paramBlock) {
return;
}
} else {
return;
}
}
// default return value is "cancel"
paramBlock.SetInt(0, 0);
....

"Adam Fletcher" <[email protected]> wrote in message
news:[email protected]...
> William,
>
> The error means that the XUL should be opened with a call to
> window.openDialog() - which takes the arguments:
>
> window.openDialog(filename, windowtitle, windowoptions, ...)
>
> where ... is turned into arguments[0], arguments[1], etc. So the XUL
> probably has an onload handler that calls some javascript that expects
> to be able to use arguments[0] as a certian type of interface.... If you
> look at printdailog.js line 366, you should be able to tell what it is
> trying to QI arguments[0] into, and by that you should know what you
> need to pass in window.openDialog as argument 0.
>
> -Adam
>
>
> William JOYE wrote:
> > Hello,
> >
> > I would like to use my own printdialog box. I have found one in the
> > XPtoolkit (printdialog.xul & printdialog.js) but when I launch this xul
file
> > I have the following error :
> > Error window.arguments[0].QueryInterface is not a function (line 366)
> >
> > Someone can help to use the printdialog ?
> >
> >
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.