Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

menulist with icon on the menuitems

53 views
Skip to first unread message

gNeandr

unread,
Dec 10, 2012, 8:02:27 PM12/10/12
to
Try to define a XUL definition to get a menu with a popup menulist. The
menuitems should show a label and a leading icon.

The following definition works partially. Opening the menulist it shows
all defined menuitems but without showing the icon.
After selection and closing the list, the menubox shows for the selected
menuitem it's icon and the label.
Fine, but I need to have the icon also on the popup menulist.

What is missing with this definition?

<menulist id="listChooser" oncommand="listChooserChanged()">
<menupopup id="allListItems">
<menuitem class="menulist-iconic"
image="chrome://... mIcon.png" label="label-1" />
<menuitem class="menulist-iconic"
image="chrome://... mIcon.png" label="label-2" />

<menuitem label="label-n" />
</menupopup>
</menulist>

As per MDN https://developer.mozilla.org/en-US/docs/XUL/menuitem#a-image
the class="menulist-iconic" is required for the menuitem, but could not
find any further request!

Zulkarnain K.

unread,
Dec 10, 2012, 11:35:44 PM12/10/12
to dev-ext...@lists.mozilla.org
On Tue, Dec 11, 2012 at 8:02 AM, gNeandr <gNeandr_@_g_m_x.de> wrote:
>
> As per MDN https://developer.mozilla.org/en-US/docs/XUL/menuitem#a-image
> the class="menulist-iconic" is required for the menuitem, but could not find
> any further request!
>

Please read again.

Thank you.

--
Zulkarnain K.
https://mozillians.org/zoolcar9

Arivald

unread,
Dec 11, 2012, 4:58:38 AM12/11/12
to
W dniu 2012-12-11 02:02, gNeandr pisze:
> Try to define a XUL definition to get a menu with a popup menulist. The
> menuitems should show a label and a leading icon.
>
> The following definition works partially. Opening the menulist it shows
> all defined menuitems but without showing the icon.
> After selection and closing the list, the menubox shows for the selected
> menuitem it's icon and the label.
> Fine, but I need to have the icon also on the popup menulist.
>
> What is missing with this definition?
>
> <menulist id="listChooser" oncommand="listChooserChanged()">
> <menupopup id="allListItems">
> <menuitem class="menulist-iconic"

<menuitem class="menuitem-iconic"

> image="chrome://... mIcon.png" label="label-1" />
> <menuitem class="menulist-iconic"
> image="chrome://... mIcon.png" label="label-2" />
>
> <menuitem label="label-n" />
> </menupopup>
> </menulist>
>
> As per MDN https://developer.mozilla.org/en-US/docs/XUL/menuitem#a-image
> the class="menulist-iconic" is required for the menuitem, but could not
> find any further request!

--
Arivald

gNeandr

unread,
Dec 11, 2012, 6:40:27 AM12/11/12
to
Sorry guys,
my posting wasn't correct ..
... with my XUL code I use class="menuitem-iconic" .. for sure.

Using DOMi to copy XML code I get:
<menuitem
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
class="menuitem-iconic" image="chrome://xxx.png" label="some label" />

And as said, the image together with the label is shown on the menu
button after selecting.

Any idea?

Arivald

unread,
Dec 11, 2012, 8:39:54 AM12/11/12
to
W dniu 2012-12-11 12:40, gNeandr pisze:
Seems to be error in global CSS (mozilla folks never needed it so they
forgot to add).
Add this to Your stylesheet:

menulist > menupopup > .menuitem-iconic > .menu-iconic-left {
-moz-appearance: menuimage !important;
}

To adjust text label, use
menulist > menupopup > .menuitem-iconic > .menu-iconic-text

--
Arivald

Zulkarnain K.

unread,
Dec 11, 2012, 3:18:21 PM12/11/12
to dev-ext...@lists.mozilla.org
Try adding this in your XUL file

<?xml-stylesheet href="chrome://global/content/xul.css" type="text/css"?>

gNeandr

unread,
Dec 11, 2012, 6:02:43 PM12/11/12
to
GREAT! This is the secret! Thanks
Günter

Neil

unread,
Dec 12, 2012, 8:22:32 AM12/12/12
to
I'm not sure what's happening here, but in general, this is a really bad
idea.

--
Warning: May contain traces of nuts.

gNeandr

unread,
Dec 12, 2012, 8:33:48 AM12/12/12
to
On 12.12.2012 13:22, Neil wrote:
> gNeandr wrote:
>
>> On 11.12.2012 20:18, Zulkarnain K. wrote:
>>
>>> Try adding this in your XUL file
>>>
>>> <?xml-stylesheet href="chrome://global/content/xul.css"
>>> type="text/css"?>
>>
>> GREAT! This is the secret! Thanks
>
> I'm not sure what's happening here, but in general, this is a really bad
> idea.
>
Hi Neil,
basically it works .. with the icon displayed also on the menuitem when
the menulist pops up.

Neil what is behind your 'bad' idea?
I imagined there is one problem:

Each menulist displays now with:

[ icon label [v] ^v ]

That is at the right it has a toolbarbutton and the 'normal' up/down arrows.

Günter

Neil

unread,
Dec 12, 2012, 8:52:47 AM12/12/12
to
gNeandr wrote:

> Try to define a XUL definition to get a menu with a popup menulist.
> The menuitems should show a label and a leading icon.

Unfortunately this is disabled in the default Windows and Linux themes.
(No, I don't know why.) You can override it by adding the following CSS
to your document:
menu.menu-iconic > .menu-iconic-left,
menuitem.menuitem-iconic > .menu-iconic-left {
display: -moz-box;

gNeandr

unread,
Dec 12, 2012, 9:03:37 AM12/12/12
to
Great!
That adds the icon to the menuitem and on the menulist there is no
additional toolbarbutton.
Thanks!
0 new messages