Article View: borland.public.cppbuilder.nativeapi
Article #9408Problem with a sorted combobox
From: Zlika
Date: Sat, 10 Jul 2004 19:10
Date: Sat, 10 Jul 2004 19:10
24 lines
1618 bytes
1618 bytes
Hi everybody!
I have a problem with the TComboBox component.
I've got a sorted ComboBox. To know which item is selected (because the
combobox is sorted), I first assign each item a ID through the Perform
method:
ComboBox->Items->Clear();
for (i=0; i<N; i++)
{
pos = ComboBox->Items->Add(Name[i]);
ComboBox->Perform(LB_SETITEMDATA,pos,i);
}
Then, when a button is pressed, I read the ID number of the selected item:
number = ComboBox->Perform(LB_GETITEMDATA,ComboBox->ItemIndex,0);
However, this last command always return 0! (whereas the value of
ComboBox->ItemIndex is correct). I really can't understand why, because I do
the same thing with a TListBox component, and it works!
Can someone tell me what is wrong?
Thank you
Zlika
Technical Details
Message-ID:
<40f03f38$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,c046cfa35a952d0b,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Zlika" <zlika_eseSTOPSPAM@hotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Problem with a sorted combobox Date: Sat, 10 Jul 2004 21:10:51 +0200 Lines: 26 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 82.120.125.31 Message-ID: <40f03f38$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1089486648 82.120.125.31 (10 Jul 2004 12:10:48 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail