Board index » cppbuilder » TListBox->Selected

TListBox->Selected

I'm trying to use a TListBox from a library. I can access the individual
items in the ListBox with declarations such as:
ListBox->Add(TwoChar->Strings[2]);
when my TListBox is declared in the library header file as:     void
CheckText(TCustomEdit*, TStrings*);

But... I need to access the selected property in order to complete the
following task:
void EditHandling::AddLetter(TCustomEdit* Edit1, TStrings* ListBox1)
{
for(int Count = 2; Count <= ListBox1->Items->Count -1; Count++)
    {
    if(ListBox1->Selected[Count])
    Edit1->Text = Edit1->Text +
ListBox1->Items->Strings[Count].SubString(1,1);
    }

Quote
}

Obviously, declaring the list box in this manner is wrong. How should I
declare it?

--
Yours,

Slartibardfast & Zephod Beeblebrox
.......................................................
Try not to spam. Your server's admin
 might get annoyed.

 

Re:TListBox->Selected


Simply declare it as a TCustomListBox* instead of a TStrings*, ie:

    void EditHandling::AddLetter(TCustomEdit* Edit1, TCustomListBox*
ListBox1)
    {
        for(int Count = 0; Count < ListBox1->Items->Count; Count++)
        {
            if(ListBox1->Selected[Count])
                Edit1->Text = Edit1->Text +
ListBox1->Items->Strings[Count].SubString(1,1);
        }
    }

Gambit

"Slartibardfast & Zephod Beeblebrox" <Rhys_Sage I think we need an "a" in a

Quote
circle, here yahoo.com> wrote in message news:3b95428f_2@dnews...
> Obviously, declaring the list box in this manner is wrong. How should I
> declare it?

Re:TListBox->Selected


Thanks Remy, It looks so obvious now that I'm embarassed I didn't think of
it myself.

--
Yours,

Slartibardfast & Zephod Beeblebrox
.......................................................
Try not to spam. Your server's admin
 might get annoyed.

Quote
Remy Lebeau <gambi...@gte.net> wrote in message news:3b954fed$3_2@dnews...
> Simply declare it as a TCustomListBox* instead of a TStrings*, ie:

>     void EditHandling::AddLetter(TCustomEdit* Edit1, TCustomListBox*
> ListBox1)
>     {
>         for(int Count = 0; Count < ListBox1->Items->Count; Count++)
>         {
>             if(ListBox1->Selected[Count])
>                 Edit1->Text = Edit1->Text +
> ListBox1->Items->Strings[Count].SubString(1,1);
>         }
>     }

> Gambit

> "Slartibardfast & Zephod Beeblebrox" <Rhys_Sage I think we need an "a" in
a
> circle, here yahoo.com> wrote in message news:3b95428f_2@dnews...

> > Obviously, declaring the list box in this manner is wrong. How should I
> > declare it?

Other Threads