MultipleSelectionListView>>selecion:ifAbsent: confuses me a bit

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

MultipleSelectionListView>>selecion:ifAbsent: confuses me a bit

Jochen Riekhof-6
Hi...

just stumbled over this Method in MultipleSelectionListView:
selection: newSelection ifAbsent: exceptionHandler
        "Legacy behaviour."
        ^self selections: newSelection ifAbsent: exceptionHandler

Shouldn't this rather use
selection: newSelection ifAbsent: exceptionHandler
        "Legacy behaviour."
        ^self selections: (Array with: newSelection) ifAbsent: exceptionHandler

or something? Or must I always pass a collection? I stumbled over it on
my calls to selectionOrNil: - do I have to send #(nil) or rather nil
directly fo rMultiSelectListViews?

Ciao

...Jochen


Reply | Threaded
Open this post in threaded view
|

Re: MultipleSelectionListView>>selecion:ifAbsent: confuses me a bit

Blair McGlashan-4
"Jochen Riekhof" <[hidden email]> wrote in message
news:[hidden email]...

> Hi...
>
> just stumbled over this Method in MultipleSelectionListView:
> selection: newSelection ifAbsent: exceptionHandler
> "Legacy behaviour."
> ^self selections: newSelection ifAbsent: exceptionHandler
>
> Shouldn't this rather use
> selection: newSelection ifAbsent: exceptionHandler
> "Legacy behaviour."
> ^self selections: (Array with: newSelection) ifAbsent: exceptionHandler

No, hence the "Legacy behaviour" comment. Legacy in this case is referring
to the fact that there was a design error in the implementation of multiple
selection lists made in the original MVP implementation.

>
> or something? Or must I always pass a collection? I stumbled over it on my
> calls to selectionOrNil: - do I have to send #(nil) or rather nil directly
> fo rMultiSelectListViews?
>

In D6 you should not use MultipleSelectionListView or
MultipleSelectionListBox. These are only present to support legacy code, and
you should migrate over to ListView and ListBox as soon as you can. In D6 a
single class supports both single and multi-select cases controlled by the
#isMultiSelect: aspect. You will then get sensible and consistent
implementations of single and multi-select list lists, which you will not
get using the old (now deprecated) classes.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: MultipleSelectionListView>>selecion:ifAbsent: confuses me a bit

Jochen Riekhof-7
Thank you Blair!

Ciao

...Jochen

"Blair McGlashan" <[hidden email]> wrote in message
news:[hidden email]...

> "Jochen Riekhof" <[hidden email]> wrote in message
> news:[hidden email]...
>> Hi...
>>
>> just stumbled over this Method in MultipleSelectionListView:
>> selection: newSelection ifAbsent: exceptionHandler
>> "Legacy behaviour."
>> ^self selections: newSelection ifAbsent: exceptionHandler
>>
>> Shouldn't this rather use
>> selection: newSelection ifAbsent: exceptionHandler
>> "Legacy behaviour."
>> ^self selections: (Array with: newSelection) ifAbsent: exceptionHandler
>
> No, hence the "Legacy behaviour" comment. Legacy in this case is referring
> to the fact that there was a design error in the implementation of
> multiple selection lists made in the original MVP implementation.
>
>>
>> or something? Or must I always pass a collection? I stumbled over it on
>> my calls to selectionOrNil: - do I have to send #(nil) or rather nil
>> directly fo rMultiSelectListViews?
>>
>
> In D6 you should not use MultipleSelectionListView or
> MultipleSelectionListBox. These are only present to support legacy code,
> and you should migrate over to ListView and ListBox as soon as you can. In
> D6 a single class supports both single and multi-select cases controlled
> by the #isMultiSelect: aspect. You will then get sensible and consistent
> implementations of single and multi-select list lists, which you will not
> get using the old (now deprecated) classes.
>
> Regards
>
> Blair
>