XUL dialog: no proper way to change which buttons are displayed other than by setting the buttons attribute

NEW
Unassigned

Status

()

Toolkit
XUL Widgets
7 years ago
7 years ago

People

(Reporter: sid0, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Since XUL dialogs have a getButton method, the reasonable thing to expect here is that changing the visibility of a button via getButton will have the same effect as adding it to the buttons property (and be reflected in the buttons property too!)

Unfortunately that just isn't the case, particularly on Windows. That's because an extra, a spacer's visibility is controlled by whether the extra2 button is present: <https://mxr.mozilla.org/seamonkey/source/toolkit/content/widgets/dialog.xml#297>

Even on other platforms the code does a lot of extra work, which might mean that the two are not the same -- I'm not really sure.
(In reply to comment #0)
> Since XUL dialogs have a getButton method, the reasonable thing to expect
> here is that changing the visibility of a button via getButton will have the
> same effect as adding it to the buttons property (and be reflected in the
> buttons property too!)

I'm not sure that this is actually a reasonable expectation. You're trying to make dialogs fit a use case they weren't really written to address (dynamically changing buttons after the fact). Given how uncommon that use case is, I'm not sure we should really invest in adding code to fulfill all of your expectations (this and bug 667565).
(Reporter)

Comment 2

7 years ago
(In reply to comment #1)
> I'm not sure that this is actually a reasonable expectation. You're trying
> to make dialogs fit a use case they weren't really written to address
> (dynamically changing buttons after the fact). Given how uncommon that use
> case is, I'm not sure we should really invest in adding code to fulfill all
> of your expectations (this and bug 667565).

This is the exact conclusion I came to in my blog post [1], but Enn asked me to file bugs for the issues I was facing. I'd be fine if all my bugs are wontfixed.

[1] http://monogatari.doukut.su/2011/06/tip-if-youre-trying-to-use-xul-for.html

Comment 3

7 years ago
This should be feasible. By comparison the XPFE dialog.xml required you to set an additional attribute if you wanted the special extra2 button behaviour.
You need to log in before you can comment on or make changes to this bug.