Page 1 of 1

MultipleSelection Behaviour

PostPosted: 21 Feb 2015 12:42
by stuartcf
Hi Team!

Here is an example of a problem I am experiencing when using Selects with MultipleSelection = True

I need to populate a multi-select box and pre-set certain items as selected in code BEFORE any user interaction. Here is an example:

with CustomiseSelect.SelectBoxList[0].Items.Add do
begin
Caption := MyQuery1.FieldByName('itemname').AsString;
Value := MyQuery1.FieldByName('itemno').AsString;
Selected := True;
Disabled := False;
end;

The problems is that the line "Selected := True;" just doesn't seem to work. I can read this property OK after user interaction to assess what options they have selected, but I can find no way to pre-set the selections and display it to the user to begin with.

Are my expectations of this components behaviour correct, or should I be using a different method?

Many thanks

Stuart.

Re: MultipleSelection Behaviour

PostPosted: 22 Feb 2015 12:01
by stuartcf
Just an update - I have found that this problem only occurs if the code is within the form's OnCreate event. I have dropped it out of there (via a timer), and I find the multi-select behaviour is as I would have expected. Thanks.

Re: MultipleSelection Behaviour

PostPosted: 23 Feb 2015 14:26
by Alexander Bulei
Hi Stuart,

You are right, it's a bug.
Fixed in next beta release.

Thank you!

Best Regards.