Search completed in 1.25 seconds.
15 results for "NsIPromptService":
nsIPromptService
MozillaTechXPCOMReferenceInterfacensIPromptService
embedding/components/windowwatcher/public/nsipromptservice.idlscriptable this interface can be used to display simple dialogs.
...to get an instance, use: var promptservice = components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getservice(components.interfaces.nsipromptservice); method overview void alert(in nsidomwindow aparent, in wstring adialogtitle, in wstring atext); void alertcheck(in nsidomwindow aparent, in wstring adialogtitle, in wstring atext, in wstring acheckmsg, inout boolean acheckstate); boolean confirm(in nsidomwindow aparent, in wstring adialogtitle, in wstring atext); boolean confirmcheck(in nsidomwindow aparent,...
...all flags are defined as unsigned long constants and can be accessed as components.interfaces.nsipromptservice.flagname from javascript and as nsipromptservice::flagname from c++.
...And 8 more matches
nsIPrompt
MozillaTechXPCOMReferenceInterfacensIPrompt
inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) note: this interface is identical to nsipromptservice but without the parent nsidomwindow parameter.
... to avoid redundancy, all methods here link to nsipromptservice.
...ndpassword(in wstring dialogtitle, in wstring text, inout wstring username, inout wstring password, in wstring checkmsg, inout boolean checkvalue); boolean select(in wstring dialogtitle, in wstring text, in pruint32 count, [array, size_is(count)] in wstring selectlist, out long outselection); constants the button flags defined in nsiprompt are the same as those defined in nsipromptservice.constants.
... example usage is also documented: using the button flags see also nsipromptservice ...
XUL Migration Guide - Archive of obsolete content
ArchiveAdd-onsAdd-on SDKGuidesXUL Migration Guide
the following complete add-on uses nsipromptservice to display an alert dialog: var {cc, ci} = require("chrome"); var promptsvc = cc["@mozilla.org/embedcomp/prompt-service;1"].
... getservice(ci.nsipromptservice); require("sdk/ui/button/action").actionbutton({ id: "xpcom-example", label: "hello from xpcom", icon: "./icon-16.png", onclick: function() { promptsvc.alert(null, "my add-on", "hello from xpcom"); } }); it's good practice to encapsulate code which uses xpcom by packaging it in its own module.
... getservice(ci.nsipromptservice); exports.alert = function(title, text) { promptsvc.alert(null, title, text); }; if we save this as "alert.js" in our add-on's lib directory, we can rewrite main.js to use it as follows: require("sdk/ui/button/action").actionbutton({ id: "xpcom-example", label: "hello from xpcom", icon: "./icon-16.png", onclick: function() { require("./alert").alert("my add-on", "hello from xpcom"); } }); one of the benefits of this is that we can control which parts of the add-on are granted chrome privileges, making it easier to review and secure the code.
Embedded Dialog API
MozillaTechEmbedded Dialog API
however, it's nearly accurate to claim that the majority of all dialogs and alerts posed by gecko do reside in a single generic component, nsipromptservice (nsipromptservice).
...i can't find any.) both contain implementations of nsipromptservice as native dialogs.
...nsipromptservice is the canonical example.
Dialogs and Prompts - Archive of obsolete content
ArchiveAdd-onsCode snippetsDialogs and Prompts
nsipromptservice is an xpcom interface available to c++ and chrome javascript code (not to web pages' js), that provides methods for displaying a few simple types of dialogs.
... links nsipromptservice open and save dialogs see also alerts and notifications ...
Adding windows and dialogs - Archive of obsolete content
ArchiveAdd-onsOverlay ExtensionsXUL SchoolAdding windows and dialogs
getservice(ci.nsipromptservice); prompts.alert(window, "alert title", "hello!"); you should of course use localized strings instead of hard-coded ones.
... getservice(ci.nsipromptservice); if (prompts.confirm(window, "confirm title", "would you like to continue?")) { // do something.
Adding items to the Folder Pane
MozillaThunderbirdThunderbird extensionsAdding items to the Folder Pane
this._children.push(new numberrow(i)); } return this._children; }, getproperties: function gne_getprops() { // put your css attributes here }, command: function gne_command() { // just going to alert, to do something here components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getservice(components.interfaces.nsipromptservice) .alert(window, null, this.text); } }; second, our child items (the numbers 1, 2, and 3) are copies of the following prototype: function numberrow(anumber) { this._number = anumber; } numberrow.prototype = { get id() { return "numbers-child-row-" + this._number; }, get text() { return this._number; }, level: 1, open: false, ...
... children: [], getproperties: function gne_kid_getprops() {}, // no-op command: function gne_kid_command() { // just going to alert, to do something here components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getservice(components.interfaces.nsipromptservice) .alert(window, null, this.text); } }; putting it all together all that is left at this point is to actually add these newly defined folder-tree-items to the folder pane's _rowmap at the appropriate time.
Accesskey display rules - Archive of obsolete content
ArchiveMozillaXULTutorialAccesskey display rules
for this issue, we recommend the following format if you use .properties: <command-name>.label=cancel <command-name>.accesskey=c note that apis of nsipromptservice are using the bad way.
Limitations of frame scripts
MozillaFirefoxMultiprocess LeftoversLimitations of frame scripts
for example: nsipromptservice nsifilepicker nsixul* <need more examples> services some services will not work in frame scripts.
Limitations of frame scripts
MozillaFirefoxMultiprocess LeftoversMessage ManagerLimitations of frame scripts
for example: nsipromptservice nsifilepicker nsixul* <need more examples> services some services will not work in frame scripts.
Services.jsm
MozillaJavaScript code modulesServices.jsm
nsiframescriptloader global frame message manager3 obs nsiobserverservice observer service perms nsipermissionmanager permission manager service ppmm nsimessagebroadcaster nsiprocessscriptloader global parent process message manager3 prefs nsiprefbranch nsiprefbranch2 nsiprefservice preferences service prompt nsipromptservice prompt service scriptloader mozijssubscriptloader javascript subscript loader service scriptsecuritymanager nsiscriptsecuritymanager script security manager search nsibrowsersearchservice browser search service startup nsiappstartup application startup service storage mozistorageservice storage api service stri...
Index
MozillaTechXPCOMIndex
846 nsipromptservice interfaces, interfaces:scriptable, reference, référence(2), xpcom interface reference you can define access keys (or keyboard shortcuts) for buttons by including an ampersand ("&") in front of the character that should be the access key for that button.
XPCOM Interface Reference
MozillaTechXPCOMReferenceInterface
icensiparserutilsnsipasswordnsipasswordmanagernsipermissionnsipermissionmanagernsipipensiplacesimportexportservicensiplacesviewnsipluginhostnsiprefbranch2nsipreflocalizedstringnsiprefservicensiprincipalnsiprinterenumeratornsiprintingpromptnsiprivatebrowsingservicensiprocessnsiprocess2nsiprocessscriptloadernsiprofilensiprofilelocknsiprofileunlockernsiprogramminglanguagensiprogresseventsinknsipromptnsipromptservicensipropertiesnsipropertynsipropertybagnsipropertybag2nsipropertyelementnsiprotocolhandlernsiprotocolproxycallbacknsiprotocolproxyfilternsiprotocolproxyservicensiproxyinfonsipushmessagensipushservicensipushsubscriptionnsiradiointerfacelayernsirandomgeneratornsirequestnsirequestobservernsiresumablechannelnsirunnablensishentrynsishistorynsishistorylistenernsisockssocketinfonsisslerrorlistenernsisslso...
XPCOM Interface Reference by grouping
MozillaTechXPCOMReferenceReference by grouping
fileinputstream nsifileoutputstream nsiinputstream nsiinputstreamcallback nsioutputstream nsioutputstreamcallback nsiscriptableinputstream nsistreamlistener url nsiioservice nsistandardurl user nsiprompt nsipromptservice zipfile nsizipentry nsizipreader nsizipreadercache nsizipwriter file nsifilepicker nsifileprotocolhandler nsifilespec nsifilestreams nsifileutilities nsifileview memory ...
Using tab-modal prompts
MozillaUsing tab-modal prompts
an alert!"]; prompt.alert.apply(null, promptargs); nsiprompt will automatically fall back to window-modal prompts when necessary (such as in situations in which tab-modal prompts aren't supported, or for prompts displayed outside the context of a tab).le to use other forms of the prompts of nsipromptservice interface see the example code.