[Widgetry] Grid announces SelectionChanged when sorting columns

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

[Widgetry] Grid announces SelectionChanged when sorting columns

Tudor Girba-3
Hi,

I encountered a small problem with Grid: when sorting columns the  
Grid announces SelectionChanged. I would say that is not a desired  
functionality.

The problem is in Grid>>sortOnColumn: method, and in particular with:

        self selectionIndexes replaceAllWith: (selectedRows collect: [:each  
| selectionsWithIndex at: each]).

This is because replaceAllWith: raises ValueChanged when adding the  
new elements.

At the moment, I fixed the problem by just suppressing the  
SelectionChanged announcement in a subclass of Grid:

        (self subscriptionRegistry subscriptionsFor: SelectionChanged)  
suspendWhile: [
                        self selectionIndexes replaceAllWith: (selectedRows collect:  
[:each | selectionsWithIndex at: each]).
        ].

Perhaps there is a better way.

Cheers,
Doru

--
www.iam.unibe.ch/~girba
www.iam.unibe.ch/~girba/blog/

"Being happy is a matter of choice."


Reply | Threaded
Open this post in threaded view
|

Re: [Widgetry] Grid announces SelectionChanged when sorting columns

Maarten Mostert-2
Hi,

In relation to SelectionChanged in grids I noticed that newValue and
oldValue remain nil.
Also the announcement location returns an Integer when selecting through
a row button and a point when selecting a cell.

It is easy to work around but but less logical  (refactoring for
Widgetry mostly means reducing code size).

@+Maarten,

PS - Samuel the fix for the Hierarchy tree editing seems to work just fine.
     - Doru thanks for the acces to your Moose store.

Tudor Girba a écrit :

> Hi,
>
> I encountered a small problem with Grid: when sorting columns the Grid
> announces SelectionChanged. I would say that is not a desired
> functionality.
>
> The problem is in Grid>>sortOnColumn: method, and in particular with:
>
>     self selectionIndexes replaceAllWith: (selectedRows collect:
> [:each | selectionsWithIndex at: each]).
>
> This is because replaceAllWith: raises ValueChanged when adding the
> new elements.
>
> At the moment, I fixed the problem by just suppressing the
> SelectionChanged announcement in a subclass of Grid:
>
>     (self subscriptionRegistry subscriptionsFor: SelectionChanged)
> suspendWhile: [
>             self selectionIndexes replaceAllWith: (selectedRows
> collect: [:each | selectionsWithIndex at: each]).
>     ].
>
> Perhaps there is a better way.
>
> Cheers,
> Doru
>
> --
> www.iam.unibe.ch/~girba
> www.iam.unibe.ch/~girba/blog/
>
> "Being happy is a matter of choice."
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [Widgetry] Grid announces SelectionChanged when sorting columns

Samuel S. Shuster <sames@interaccess.com>
In reply to this post by Tudor Girba-3
Doru:

>Perhaps there is a better way.

Nope, that's the right way, but it shouldn't do that, so I'll fix it.

                                And So It Goes
                                     Sames
______________________________________________________________________

Samuel S. Shuster [|]
VisualWorks Engineering, GUI Project
Smalltalk Enables Success -- What Are YOU Using?

Reply | Threaded
Open this post in threaded view
|

Re: [Widgetry] Grid announces SelectionChanged when sorting columns

Samuel S. Shuster <sames@interaccess.com>
In reply to this post by Maarten Mostert-2
Maarten,

>In relation to SelectionChanged in grids I noticed that newValue and
>oldValue remain nil.

Yeah. At one time we hoped they would carry info, but it turns out that they
couldn't.

>Also the announcement location returns an Integer when selecting through
>a row button and a point when selecting a cell.

That is intentional.

>PS - Samuel the fix for the Hierarchy tree editing seems to work just fine.

Great!

                                And So It Goes
                                     Sames
______________________________________________________________________

Samuel S. Shuster [|]
VisualWorks Engineering, GUI Project
Smalltalk Enables Success -- What Are YOU Using?

Reply | Threaded
Open this post in threaded view
|

RE: [Widgetry] Grid announces SelectionChanged when sorting columns

Boris Popov, DeepCove Labs (SNN)
Could row selection just be a point with a zero X coordinate for
consistency?

Cheers,

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]
> Sent: Monday, August 27, 2007 10:20 AM
> To: [hidden email]
> Cc: Tudor Girba; vwnc nc
> Subject: Re: [Widgetry] Grid announces SelectionChanged when sorting
> columns
>
> Maarten,
>
> >In relation to SelectionChanged in grids I noticed that newValue and
> >oldValue remain nil.
>
> Yeah. At one time we hoped they would carry info, but it turns out
that
> they
> couldn't.
>
> >Also the announcement location returns an Integer when selecting
through

> >a row button and a point when selecting a cell.
>
> That is intentional.
>
> >PS - Samuel the fix for the Hierarchy tree editing seems to work just
> fine.
>
> Great!
>
>                                 And So It Goes
>                                      Sames
> ______________________________________________________________________
>
> Samuel S. Shuster [|]
> VisualWorks Engineering, GUI Project
> Smalltalk Enables Success -- What Are YOU Using?