Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xul's listitem command attribute does not work?

Xul's listitem command attribute does not work?

I've made this sample, and it's just not working:

<?xml version="1.0" encoding="UTF-8"?>

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

<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

    <commandset>
        <command id="cmd_dump" oncommand="dump('ok');" />
    </commandset>

    <vbox style="background:#FFFFFF;" flex="1">
        <spacer flex="1" />
        <hbox pack="center">

            <listbox flex="1">
                <listitem label="Test1" command="cmd_dump" />
                <listitem label="Test2" command="cmd_dump" />
            </listbox>

        </hbox>
        <spacer flex="1" />
    </vbox>

</window>

How to make it work?

like image 794
The Student Avatar asked Sep 14 '26 22:09

The Student


2 Answers

I didn't work for me either. But making type = checkbox does fire the command. You can get rid of the checkbox using absolute positioning and negative margins but thats an ugly hack.

A better way would be to listen for the click event of the <listitem> in Javascript.

As Cedric said, it might be a bug although the example at controllers - MDC works.

like image 171
Manu Avatar answered Sep 17 '26 12:09

Manu


Tom - I come to the same conclusion as yours, having tried in a different way to make a command work, and quickly checked on the Internet (I even found one of your posts on a forum from the beginning of the month).

However, have you tried it with an old version of Firefox (or an old version of the XULRunner engine)? Maybe you can change slightly want you want your screen to be, like using a command when going out of it, so that you can avoid this problem?

It may be worth asking your question on this channel : #xul on irc.mozilla.org. They may end up telling you it's a bug.

like image 25
Cedric Avatar answered Sep 17 '26 12:09

Cedric