I thought I knew how to do this but it appears I dont! Setting starting values for the standard combobox plugin

  • I have a tour where I would like to set the default value of the combobox items with a variable when the tour starts. For example:

    Code
    onload(), variable initmusic is passed into the xml from a cookie via javascript and initvars:{initmusic:initmusic...
        
    <combobox name="cb_music" design="greycombo" zorder="202"  keep="true"
         x="20px" y="1999px" visible="true" align="center" edge="left"
         >
         <item name="M1" caption="auto Music ON"  onclick="set(initmusic, 'M1' );" 
    />
         <item name="M0" caption="auto Music OFF" onclick="set(initmusic, 'M0' );" />
    </combobox>

    Another action is used to write cookies with a varient of settings, that all works. it's only the reading and setting that are a problem.

    I have tried lots of combinations based on:

    Code
      trace(get(layer[get(cb_music)].selecteditemindex;););
      trace(get(layer[cb_music].selecteditemindex;););

    and seem unable to even read what is selected far less preset or setup the combobox using the (cookie) variable.


    Thanks
    James

  • james December 4, 2023 at 9:17 AM

    Changed the title of the thread from “I thought I knew hw to use ths but it appears I dont! Setting starting values for the standard combobox” to “I thought I knew how to do this but it appears I dont! Setting starting values for the standard combobox plugin”.
  • Fantastic, I never thought of putting the onload in the combobox declaration, as opposed to the item declaration. Obvious when it is laid in front of you.

    Thanks
    James

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!