I have already searched the Internet for several hours for solution and
so far I have found this answer to this question, and I tried it, but
couldn't get it to work:
http://groups-beta.google.com/group/netscape.public.dev.xul/msg/02075a1736406b40
Does anyone know where I could find a full working example code for
this? (Basicly the code for the function creating the dialog and the
code for the modal dialog would be enough.)
BTW if you haven't seen it, here's an article that describes various
problems and solutions working with multiple windows:
http://developer.mozilla.org/en/docs/Working_with_windows_in_chrome_code
Nickolay
The code to open the a dialog named mydialog.xul and pass it arguments:
var params = {inn:{name:"foo", description:"bar", enabled:true}, out:null};
window.openDialog("chrome://myext/chrome/mydialog.xul", "",
"chrome, dialog, modal, resizable=yes", params).focus();
if (params.out) {
// user clicked ok--process changed arguments (write them to disk or whatever)
}
mydialog.xul:
<dialog
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="theId"
title="some title"
ondialogaccept="return onOK();"
onload="onLoad();"
persist="screenX screenY width height"
windowtype="mywintype">
<script type="application/x-javascript" src="chrome://myext/content/mydialog.js"/>
// xul here
</dialog>
mydialog.js:
function onLoad() {
sizeToContent();
// use the arguments passed to us
document.getElementById("name").value = window.arguments[0].inn.name;
document.getElementById("description").value = window.arguments[0].inn.description;
document.getElementById("enabled").checked = window.arguments[0].inn.enabled;
}
function onOK() {
// return the changed arguments.
// notice if user clicks cancel, window.arguments[0].out remains null
window.arguments[0].out = {name:document.getElementById("name").value,
description:document.getElementById("description").value,
enabled:document.getElementById("enabled").checked};
return true;
}
HTH,
Eric Jung
----- Original Message ----
From: Aggro <spamme...@yahoo.com>
To: dev-ext...@lists.mozilla.org
Sent: Tuesday, October 24, 2006 5:43:41 PM
Subject: How to get return value from modal dialog?
I need to open a modal dialog, which will show a list of items from
which the user can select one. I then need to return the selected value
to the function that created that dialog.
I have already searched the Internet for several hours for solution and
so far I have found this answer to this question, and I tried it, but
couldn't get it to work:
http://groups-beta.google.com/group/netscape.public.dev.xul/msg/02075a1736406b40
Does anyone know where I could find a full working example code for
this? (Basicly the code for the function creating the dialog and the
code for the modal dialog would be enough.)
_______________________________________________
dev-extensions mailing list
dev-ext...@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-extensions
Thank you, this solved my problem.
nsIRDFRemoteDataSource
<http://www.xulplanet.com/references/xpcomref/ifaces/nsIRDFRemoteDataSource.html>
This interface appears to have several methods you can use including:
void Flush ( )
Request that a data source write it's contents out to permanent storage,
if applicable.
void Refresh ( PRBool blocking )
Refresh the remote datasource, re-loading its contents from the URI.
Arguments:
blocking: If true, the call will block until the datasource has
completely reloaded.
Phil
--
Philip Chee <phi...@aleytys.pc.my>, <phili...@gmail.com>
http://flashblock.mozdev.org/ http://xsidebar.mozdev.org
Guard us from the she-wolf and the wolf, and guard us from the thief,
oh Night, and so be good for us to pass.
[ ]What if there were no hypothetical situations?
* TagZilla 0.059
Look at what addEngine does. I'd expect the update to happen
automatically, but it may be needed to call rebuild() on the template
builder.
Also, do you know that Fx2 allows deleting search engines?
Nickolay
I think also what Philip said about calling refresh() on the
RemoteDataSource interface might also be what I am looking for.
Essentially I want the RDF to pickup the changes that have occured in
the searchplugins directory. Thanks.
-Mark
-Mark
var rdf =
Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
ds = rdf.GetDataSource("rdf:internetsearch");
ds.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
ds.Flush();
engine.builder.rebuild();
But I get an error that an interface is not available when I run my
code. Any suggestions?