Board index » cppbuilder » if (TListBox->MultiSelect == false) TListBox->Selected = readonly ?

if (TListBox->MultiSelect == false) TListBox->Selected = readonly ?

When I set the MultiSelect property of a TListBox component to false,
I can no longer set the contents of the Select property in my code.

The fact that you can only select 1 should be my problem, right ?

Adrian.

 

Re:if (TListBox->MultiSelect == false) TListBox->Selected = readonly ?


Check help for TListBox->Selected you have to check each item in the array
for being selected
--
HTH Pete
GenHelp: The Component Writers Help Authoring package
=================================
Web:  www.frasersoft.net
Quote
"Adrian" <AHeest...@hotmail.com> wrote in message news:3cb40ba0$1_2@dnews...
> When I set the MultiSelect property of a TListBox component to false,
> I can no longer set the contents of the Select property in my code.

> The fact that you can only select 1 should be my problem, right ?

Re:if (TListBox->MultiSelect == false) TListBox->Selected = readonly ?


It's not the reading of Selected that I have a problem with, it's the
writing.
After filling the list (in code), I want to select the first item (in code).
This does work when MultiSelect is true, but doesn't when MultiSelect is
false.

Adrian.

Pete Fraser <pete.fra...@at.frasersoft.dot.net> schreef in berichtnieuws
3cb41437_1@dnews...

Quote
> Check help for TListBox->Selected you have to check each item in the array
> for being selected
> --
> HTH Pete
> GenHelp: The Component Writers Help Authoring package
> =================================
> Web:  www.frasersoft.net

> "Adrian" <AHeest...@hotmail.com> wrote in message

news:3cb40ba0$1_2@dnews...
Quote
> > When I set the MultiSelect property of a TListBox component to false,
> > I can no longer set the contents of the Select property in my code.

> > The fact that you can only select 1 should be my problem, right ?

Re:if (TListBox->MultiSelect == false) TListBox->Selected = readonly ?


You MUST use the Selected flags as well i.e. loop round de-selecting all but
first in your case.
HTH Pete

Quote
"Adrian" <AHeest...@hotmail.com> wrote in message news:3cb42abe$1_1@dnews...
> It's not the reading of Selected that I have a problem with, it's the
> writing.
> After filling the list (in code), I want to select the first item (in
code).
> This does work when MultiSelect is true, but doesn't when MultiSelect is
> false.

> Adrian.

> Pete Fraser <pete.fra...@at.frasersoft.dot.net> schreef in berichtnieuws
> 3cb41437_1@dnews...
> > Check help for TListBox->Selected you have to check each item in the
array
> > for being selected
> > --
> > HTH Pete
> > GenHelp: The Component Writers Help Authoring package
> > =================================
> > Web:  www.frasersoft.net

> > "Adrian" <AHeest...@hotmail.com> wrote in message
> news:3cb40ba0$1_2@dnews...
> > > When I set the MultiSelect property of a TListBox component to false,
> > > I can no longer set the contents of the Select property in my code.

> > > The fact that you can only select 1 should be my problem, right ?

Other Threads