Re: [Pharo-users] Mouse events in FastTableModel subclass [Spec]
Update: problem fixed by adding an "Announcer" to the "double click" event, i.e.: morWidget onAnnouncement: FTStrongSelectionChanged send: #doubleClick: to: self. Where "morWidget" is the morphic object representing a list of pictures, "self" is the "MorphicPictureListAdapter", which creates the "morWidget" object. The method "doubleClick:" contains the actions to be performed when the event is triggered. Note that, in the "FTAnnouncement" hierachy, the "double click" event is represented by the class "FTStrongSelectionChanged", which I found a little tricky. Bye, Matteo
Thanks for the follow up. This will probably be useful for me to know later. cheers -ben On Fri, Jan 6, 2017 at 11:34 PM, Matteo <matteob8@yahoo.it> wrote:
Update: problem fixed by adding an "Announcer" to the "double click" event, i.e.:
morWidget onAnnouncement: FTStrongSelectionChanged send: #doubleClick: to: self.
Where "morWidget" is the morphic object representing a list of pictures, "self" is the "MorphicPictureListAdapter", which creates the "morWidget" object. The method "doubleClick:" contains the actions to be performed when the event is triggered.
Note that, in the "FTAnnouncement" hierachy, the "double click" event is represented by the class "FTStrongSelectionChanged", which I found a little tricky.
Bye, Matteo
You can get the selection directly in FastTableModel by Setting #handlesDoubleClick: to true and the event handler block using #doubleClickAction: --------------------- FastTableModel new icons: [ :e | example iconNamed: #forwardIcon ]; items: (1 to: 10) asArray; handlesDoubleClick: true; doubleClickAction: [ :ftStrong | ftStrong inspect ]; whenSelectedItemChanged: [ :new :old :something :announcment | { new . old . something . announcment } inspectOnce ]; openWithSpec. ----------------------- Best regards, Henrik -----Opprinnelig melding----- Fra: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] PÃ¥ vegne av Matteo Sendt: 06 January 2017 16:35 Til: pharo-users@lists.pharo.org Emne: Re: [Pharo-users] Mouse events in FastTableModel subclass [Spec] Update: problem fixed by adding an "Announcer" to the "double click" event, i.e.: morWidget onAnnouncement: FTStrongSelectionChanged send: #doubleClick: to: self. Where "morWidget" is the morphic object representing a list of pictures, "self" is the "MorphicPictureListAdapter", which creates the "morWidget" object. The method "doubleClick:" contains the actions to be performed when the event is triggered. Note that, in the "FTAnnouncement" hierachy, the "double click" event is represented by the class "FTStrongSelectionChanged", which I found a little tricky. Bye, Matteo
Hi Henrik, thanks for the hint. (I think that the code snippet misses the definition of the "example" variable). Unfortunately the "problem" is located in the "Morphic Side" of the "FastTableModel" class. Specifically the "FastTableModel" class relies on the "MorphicFastTableAdapter" which in turn (surprisingly) uses the "FTPluggableIconListMorphAdaptor", and not the "FTTableMorph" as I would expect. The announcer for the "double click" is coded in the "FTPluggableIconListMorphAdaptor>>initializeSelections", by the announcement "FTStrongSelectionChanged", as follow: --------------------- initializeSelections self onAnnouncement: FTSelectionChanged send: #selectionChanged: to: self. self onAnnouncement: FTStrongSelectionChanged send: #strongSelectionChanged: to: self. --------------------- In my case "PictureListModel" is a subclass of "FastTableModel" and it has been connected to a "FTTableMorph" object (through the "MorphicPictureListAdapter") and NOT to a "FTPluggableIconListMorphAdaptor" one. In this way the "double click" has been lost. I've wanted to avoid the "FTPluggableIconListMorphAdaptor" because it seems a bridge for legacy code, as reported in a previous post, see http://forum.world.st/Spec-Setting-rows-height-of-a-pictures-list-tp4920861p.... Cheers, Matteo On 06/01/17 18:20, Henrik Nergaard wrote:
You can get the selection directly in FastTableModel by Setting #handlesDoubleClick: to true and the event handler block using #doubleClickAction:
--------------------- FastTableModel new icons: [ :e | example iconNamed: #forwardIcon ]; items: (1 to: 10) asArray; handlesDoubleClick: true; doubleClickAction: [ :ftStrong | ftStrong inspect ]; whenSelectedItemChanged: [ :new :old :something :announcment | { new . old . something . announcment } inspectOnce ]; openWithSpec. -----------------------
Best regards, Henrik
-----Opprinnelig melding----- Fra: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] PÃ¥ vegne av Matteo Sendt: 06 January 2017 16:35 Til: pharo-users@lists.pharo.org Emne: Re: [Pharo-users] Mouse events in FastTableModel subclass [Spec]
Update: problem fixed by adding an "Announcer" to the "double click" event, i.e.:
morWidget onAnnouncement: FTStrongSelectionChanged send: #doubleClick: to: self.
Where "morWidget" is the morphic object representing a list of pictures, "self" is the "MorphicPictureListAdapter", which creates the "morWidget" object. The method "doubleClick:" contains the actions to be performed when the event is triggered.
Note that, in the "FTAnnouncement" hierachy, the "double click" event is represented by the class "FTStrongSelectionChanged", which I found a little tricky.
Bye, Matteo
participants (3)
-
Ben Coman -
Henrik Nergaard -
Matteo