[solved] How to get the current item name in combobox plugin?

  • Hi,

    This is a example:<combobox name="mycb"
    <item name="myitem1" caption=" bla1'
    onclick="tracing_this_itemname "/>
    </combobox>

    <action name="tracing_this_itemname ">
    trace(get(layer[get(name)].item.name))
    </action>

    The red code is bad. How to get the current item name?
    Note: I need to get dynamically this name in order to use this code for any item, any combobox.

    Greets,
    Fernando

    Einmal editiert, zuletzt von Fernando (29. Mai 2018 um 16:21)

  • Hi Jordi. Thanks... But Where in the link the answer is? *confused*

    Is it here?
    layer[cbname].item[itemname].*

    I think that my problem is other:

    <combobox name="cbname">
    <item name="myitem1"/>
    </combobox>

    trace(layer[get(name)].item[????}.name); In this case it is not the number of index what I want to enter but something generic as get (name) is it

    The idea is obtaining the value "myitem1" without having to give no piece of information. Of similar way to using get(name) that precisely you get the combobox name ("cbname")

    Please if you have a solution put an example, *wink*

    Greets,
    Fernando

  • Hi, this a question relative a any combobox with action in a specific item

    This works fine:
    trace(get(layer[get(name)].item[1].name);

    This works fine too: (It does not make sense a lot but it works...)
    trace(get(layer[get(name)].item[item1name].name);

    Is there any possibilities of referring to the name of the item that generates the action?
    trace(get(layer[get(name)].item[get(?)].name);

    Almost sure that it is impossible, only I ask in case there is some trick *sleeping*

    Best Regards,
    Fernando

  • Hi,

    here:

    Code
    trace(layer[get(name)].item[get(layer[get(name)].selecteditemindex)].name);

    or here maybe a bit nicer:

    Code
    copy(cb, layer[get(name)]);
    trace(cb.item[get(cb.selecteditemindex)].name);

    Best regards,
    Klaus

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!