[Project_owners] Dialog question.

Neil Deakin enndeakin at sympatico.ca
Sun Feb 1 11:03:59 EST 2004

Jaap A. Haitsma wrote:

> Hi,
> I'm trying to change one of my dialogs. Sofar unsuccesfully.
> Basically I want a dialog with a Yes and No button below some text 
> asking a question.
> I have the following code up till now (there are some linewraps due to 
> my or your email program)
> --------------------------------------------
> <dialog id="accept_postdata" title="Warning!!!!!!!!!!!!"
> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
>         buttons="none">
> <vbox>
> <description>Are you really sure that want to enable Reload 
> Every?</description>
> <hbox align="center">
> <button label="Yes" 
> oncommand="window.arguments[0](true);acceptButton();" />
> <button label="No" 
> oncommand="window.arguments[0](false);cancelButton()" />
> </hbox>
> </vbox>
> </dialog>
> ----------------------------------------------------
> I have the following questions:
> 1. I do not want the the Accept and Cancel button. If I leave out the 
> buttons property of dialog, I still get them. I now set 
> buttons="none". This works but it is not documented anywhere. What's 
> the official way??

Use the dlgtype attribute to replace one of the dialog buttons:

<button dlgtype="accept" label="Yes"/>
<button dlgtype="cancel" label="No"/>

> 2. I want Yes and No to appear in the center (middle) of the dialog.
> How do I get this to work. I already used align halign valign 
> box-align, but still no buttons in the middle :-(


align controls the alignment in the opposite direction from the box 

> 3. acceptButton() and cancelButton() should do the same as the accept 
> and cancel buttons and close the dialog. However my dialog does not 
> get closed. :-(

The dlgtype attribute will handle this for you.

/ Neil

More information about the Project_owners mailing list