nsIPrompt and snippet [ << Previous | Contents | Next >> ]
nsIPrompt and snippet

You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



Implemented by you and provides methods for...
  • Alert/Confirm (with checkbox options)
  • List box selection
  • ConfirmEx() - customized dialogs

  #include "nsIPromptService.h"
  ...
  NS_IMETHODIMP CPromptService::Confirm(nsIDOMWindow *parent,
                                        const PRUnichar *dialogTitle,
                                        const PRUnichar *text,
                                        PRBool *_retval)
  {
    CWnd *wnd = CWndForDOMWindow(parent);
    int choice;

    if (wnd)
      choice = wnd->MessageBox(W2T(text), W2T(dialogTitle),
                      MB_YESNO | MB_ICONEXCLAMATION);
    else
      choice = ::MessageBox(0, W2T(text), W2T(dialogTitle),
                      MB_YESNO | MB_ICONEXCLAMATION);

    *_retval = choice == IDYES ? PR_TRUE : PR_FALSE;
    return NS_OK;
  }