CPB Mailing List
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: ComboBox Bug, A Real Doozy!
You're right. It doesn't do that. It seems the OnChange event is called
before the ComboBox sets its text from the selected item. I don't see
any way of doing what you want, so I have to ask: Why can't you do all
of this parsing before any item is selected? Do you really need to
display the parsed item in the combobox? It seems confusing to select
one thing and have something else displayed - maybe it would be more
user friendly to show the parsed string in a nearby edit box.
Of course, the above is all retracted if someone finds a real solution
to your problem (aren't justifications great?).
> -----Original Message-----
> From: John Khouri [SMTP:jkhouri@lucent.com]
> Sent: Wednesday, July 30, 1997 1:14 PM
> To: cpb-thread@zdtips.com
> Subject: ComboBox Bug, A Real Doozy!
>
> 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