CPB Mailing List
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ComboBox Bug, A Real Doozy!
Since you want your text to be something that is not in the list, I bet you must
set the ItemIndex property to -1 to make this work.
Jack Romanowicz
John Khouri wrote:
> Background:
> I need to display phone extensions in a ComboBox.
> I have a ComboBox that displays the phone extensions, and when the user
> clicks the down arrow, the drop down list appears with extensions and
> names.
> (BTW: to adjust the width of the drop down, use CB_SETDROPPEDWIDTH.)
> When the drop down closes, it sends a OnChange event.
> I have an OnChange method for the ComboBox.
> In the OnChange method, I check to see if the Text for the ComboBox has
> more than an extension. If it does, I parse the Text and set it to just
> the extension.
>
> Problem:
> The Text in the ComboBox is set to what was selected from the drop down,
> not the new Text that was just parsed!
> I put together a test app, and it has the same behavior (in Delphi and
> C++Builder!).
>
> To Test:
> Create a new app.
> Place a TComboBox on the form.
> Set the Items property to 1 2 3 4 5 (each number on its own line).
> Double click the ComboBox.
> Enter the Following...
> ComboBox1->Text = "abc";
> ShowMessage(ComboBox1->Text);
> Run it.
> Using the drop down, change the value to ... say 3.
> The value of the Text field is "abc"; Click OK.
> The value of the Text field is now "3".
>
> Have fun!
>
> John Khouri
>
> PS. A timer is looking real good right now :)
W Komornicki's Home Page |
Main Index |
Thread Index