10 Replies Latest reply on Jul 29, 2007 7:40 PM by wgb14

    (OSControl Xtra) Popup menu

    wgb14 Level 1
      Hi all

      I wonder if anyone know how to give more than one line of code in the Popup menu data field (after the | character). In particular I would like to write this code chunk but seems quite difficult...


      global state
      window("Haptek_player").movie.sprite(1).Hypertext = " \setSwitch [figure= fullBod switch= intro state= start]
      state = "start"
      end

      It should be something like

      test1| global state window("Haptek_player").movie.sprite(1).Hypertext = " \setSwitch [figure= fullBod switch= intro state= start ]state = "start"

      but it returns an error... any idea what i am doing wrong?
        • 1. Re: (OSControl Xtra) Popup menu
          Level 7
          Why don't you have it execute a single callback handler when selected
          and use this handler to take care of whatever needs to happen?
          • 2. Re: (OSControl Xtra) Popup menu
            wgb14 Level 1
            I want to avoid writing multiple handlers and include everything in the data field (if that is posible).
            • 3. Re: (OSControl Xtra) Popup menu
              Level 7
              You could try to construct a 'do' statement.
              • 4. Re: (OSControl Xtra) Popup menu
                wgb14 Level 1
                Hi

                I used the itemdelimiter and I got what i wanted... problem solved... However, I have one more question (sorry but the documention of the control is somehow confusing).... I am trying to disable a certain item of my popmenu and set the color to another using this:

                sprite(3).setItem(2,[#fontColor: 202,202,202])
                sprite(3).setItem(3,[#enabled: 0])


                But it doesn't work.... any idea what i am doing wrong? Many thanks for your replies so far...
                • 5. Re: (OSControl Xtra) Popup menu
                  Level 7
                  > sprite(3).setItem(2,[#fontColor: 202,202,202])
                  > sprite(3).setItem(3,[#enabled: 0])
                  >
                  > But it doesn't work

                  Define "doesn't work"?

                  I suspect when you say Popup menu that you're referring to an #OSMenu
                  sprite as opposed to an #OSPopupMenu.
                  As far as I know, there is no #fontColor property for an item in an
                  OSMenu, so perhaps this is throwing errors. Try commenting that line out.

                  While many are happy to provide help, you could help those trying to
                  provide it by being specific about what you're seeing and what you
                  expect to see; with relevant code, error messages, etc. cited
                  • 6. Re: (OSControl Xtra) Popup menu
                    wgb14 Level 1
                    No I am reffering to an SPopupMenu sprite.... What I am trying to do is to disable the third item from my popup menu and change the color of the second item. The "doesn't work" means that it doesn't do what I am expecting it to do (.. actually the two lines of code are not doing anything). Here is my complete code that is attached to my OSPopupMenu sprite.

                    on mouseup

                    sprite(3).setItem(2,[#fontColor: 202,202,202])
                    sprite(3).setItem(3,[#enabled: 0])

                    end



                    • 7. Re: (OSControl Xtra) Popup menu
                      Level 7
                      > sprite(3).setItem(2,[#fontColor: 202,202,202])

                      If you look at the docs, the #fontColor property for OSPopupMenu
                      sprites/members is read-only, so did you try commenting that line out?
                      • 8. (OSControl Xtra) Popup menu
                        wgb14 Level 1
                        Ops.. I didn't see that... OK still trying the disabled part.... I wonder if my code is correct (sprite(3).setItem(1,[#enabled: 0]) why the first item of my Popup menu doesn't gray out?

                        This is the field for my Popup menu

                        ----Scripted Moods----- -- I want this line to grey out
                        Happy2|window("Haptek_player").movie.sprite(1).Hypertext ="\Load [file= [scripts/Happy.txt]]"
                        Happy3|window("Haptek_player").movie.sprite(1).Hypertext ="\Load [file= [scripts/mood_happy.txt]]"
                        Neutral||window("Haptek_player").movie.sprite(1).Hypertext ="\Load [file= [scripts/Hap_Neutral.txt]]"
                        MoodeNone|window("Haptek_player").movie.sprite(1).Hypertext ="\Load [file= [scripts/mood_none.txt]]"
                        ---Safe Moods----- -- this line as well
                        Happy|window("Haptek_player").movie.sprite(1).Hypertext ="\Load [file= [data/standard/safe_moods/Hap_Happy.hap]]"
                        Neutral| window("Haptek_player").movie.sprite(1).Hypertext ="\Load [file= [data/standard/safe_moods/Hap_Neutral.hap]]"
                        Calm| window("Haptek_player").movie.sprite(1).Hypertext =" \Load [file= [data/standard/safe_moods/Hap_Calm.hap]]"
                        • 9. Re: (OSControl Xtra) Popup menu
                          Level 7
                          Back to the docs:
                          "...a Windows Listbox (the pop-up part of the Combobox) cannot contain
                          <snip> disabled items <snip>. So these will not show up on Windows..."

                          If you need to disable an item in a PopupMenu on Windows, you'll perhaps
                          need to remove it altogether.
                          • 10. Re: (OSControl Xtra) Popup menu
                            wgb14 Level 1
                            Thank you Sean...