[Gambas-user] ComboBox.Clear ???
Mike Keehan
mike_keehan at ...679...
Sun Jan 2 15:01:26 CET 2005
Hi Jay,
Jay Loos wrote:
> This is labeled ComboBox.Clear because I was testing out the widgets on
> Gambas and I wanted to just clear the information in the ComboBox but
> for some reason the combobox is transformed to a text input box with no
> access to the list of the combobox.
>
> In other words I create a ComboBox with like 10 names to choose from.
> Running the program the ComboBox shows in the window with the abilty to
> choose one of the 10 names. That all works fine. Now I add a button to
> the application ; lets call it a Clear button and put the code in it
> like so : " ComboBox1.Clear ". We run the application again and I am
> able to choose a name from the combobox as usual but now I get lazy and
> hit the Clear button just because I want to do it that way. The
> ComboBox1 clears and I want to choose another name from ComboBox1 but I
> cannot access the list. I left click the mouse button on the arrow and
> no list appears. I can type in the ComboBox but again no list. Hmmmmm.
>
> To correct this problem I have put a band aid on it but redoing the code
> like so : " ComboBox1.Text = " "" " If I do that I still get
> access the the ComboBox list and the ComboBox is then cleared of
> whatever is in it.
>
As you have found out, ComboBox.Clear will clear all the list. If you
just want to clear the displayed name, try ComboBox.Text = "". You
may need to include a blank entry in your list of names for this to work.
Setting the ComboBox.Text to one of the names in the list will
highlight that name when you click the arrow button on the combo box.
Mike.
More information about the User
mailing list