1 Reply Latest reply on Nov 11, 2009 12:59 AM by Ratsnackbar

    How to set the selectedIndex of a combobox without showing it.


      My application displays a combobox in a popup window to allow users to make a selection.  Then, of course, a button is clicked and the selectedLabel is displayed on another part of the screen.  My problem comes when the button is clicked before the popup window is shown, which will happen without a doubt.  If I try to get the selectedLabel without showing the combobox it returns nothing, and this just won't work.  I can't hard code the value of the selectedLabel in a string, because it will change depending on other selections.  As long as I show the combo box I can get the selectedLabel, but if I don't show it first nothing is returned.

      I've tried setting selectedIndex any number of ways, in a preinitialize functions, in a creationcomplete functions, etc, but nothing seems to work.


      I can provide source code if it's needed.


      Message was edited by: DavidTheJavaProgramm All right, I found a way to get what I need without showing the popup window, but of course that led to another problem.  How do I show the window, make a selection in the combo box, close the window, then show it again with the same selection?

        • 1. Re: How to set the selectedIndex of a combobox without showing it.
          Ratsnackbar Level 2

          It sounds like your popup is a unique component (there is only one of it) and that it could be displayed for selection mutiple times over the course of the application.  In that situation you might want to consider simply disabling the mouseEvents on it and setting it's visibility to false.  The object is still available and in it's state that it was last left in only you cannot interact with it until it is rematerialized.  This is somewhat of a cop-out but a common way to handle singleton display objects.