Hi, I'm back with more annoying questions :)Using #whenSelectedItemsChanged:, I see that the block is evaluated a lot of times:log := OrderedCollection new.roots := #(1 2) collect: [ :each |TreeNodeModel newcontent: each;selected: true;yourself ].TreeModel newroots: roots;multiSelection: true;whenSelectedItemsChanged: [ :items |log add: items ];openWithSpec.log ---> an OrderedCollection(#() an OrderedCollection(1) an OrderedCollection(1) an OrderedCollection(1 2) an OrderedCollection(1 2) an OrderedCollection(1 2))I'd expect only one evaluation... is it a bug or a feature?cheers,Mart�nOn Sun, Dec 8, 2013 at 12:22 AM, Martin Dias <tinchodias@gmail.com> wrote:
aha! thanks
Mart�n
On Sat, Dec 7, 2013 at 10:33 AM, Benjamin
<Benjamin.VanRyseghem.Pharo@gmail.com> wrote:
> roots := #(1 2 3) collect: [ :e | TreeNodeModel new content: e ; yourself ].
>
> TreeModel new
> roots: roots;
> multiSelection: true;
> openWithSpec.
>
> roots third
> selected: true;
> takeHighlight
>
> Ben
>
> On 07 Dec 2013, at 05:44, Martin Dias <tinchodias@gmail.com> wrote:
>
> ouch! thanks Ben.
>
> Another related question: is there any way of selecting an arbitrary
> item? I tried (among others) with:
>
> TreeModel new
> roots: #(1 2 3);
> multiSelection: true;
> openWithSpec;
> selection: 3
>
> without success.
>
> Cheers,
> Mart�n
>
>
>
> On Thu, Dec 5, 2013 at 4:17 PM, Benjamin
> <Benjamin.VanRyseghem.Pharo@gmail.com> wrote:
>
> your tree here is single selection so it will not work
>
> TreeModel new
> roots: #(1 2 3);
> multiSelection: true;
> openWithSpec;
> selectAll
>
> Ben
>
> On 05 Dec 2013, at 15:38, Martin Dias <tinchodias@gmail.com> wrote:
>
> Hi,
>
> I'm not sure how this method should be used. I tried in different
> ways, for example:
>
> TreeModel new
> roots: #(1 2 3);
> selectAll;
> openWithSpec
>
> But always the items are unselected. Is it a bug? or I didn't find the
> way to use it?
>
> Thanks,
> Mart�n
>
>
>
>