Xul command attribute listitem not working?

Xul listitem command attribute not working?

I made this sample and it just doesn't work:

<?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?

+3
source share
3 answers

Typically, lists are used to provide one or more options, rather than a list of actions. As far as I can tell from your question, you provide some kind of customization user interface, in which case you have several options:

  • Create a selection list for multiple items. The user selects the items they need. This can be cumbersome because they need to remember to hold down the Ctrl key to switch the selection of a specific item.
  • . .
  • (, " β†’" "← ". " " " ", .
0

. , , ( ).

, Firefox ( XULRunner)? , , , , , , ?

, : #xul irc.mozilla.org. .

+2

I did not work for me either. But the creation type = checkboxstarts command. You can get rid of the checkbox using absolute positioning and negative margins, but it's an ugly hack.

It would be best to listen to the event click <listitem>in Javascript.

As Cedric said, it could be a mistake, although an example of controllers works - MDC .

+2
source

Source: https://habr.com/ru/post/1783915/


All Articles