Is there an easier way to get equivalent of selectionAct: for double clicks?

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

Is there an easier way to get equivalent of selectionAct: for double clicks?

Sam Adams-2

First, THANKS FOR BREATHING NEW LIFE INTO SMALLTALK!!!!!

We've adopted Pharo/Moose/et.al. for a major project in IBM Research, and as a 29-year Smalltalk veteran, I am simply blown away by all the extreme functionality the community has developed.
In getting used to Glamour, I found a need for a doubleClick action, but the only examples and APIs I could locate used the transmission to update another pane.  I worked out how to do what I need using a "hidden pane", but its an awkward hack.  What I would really like is a strongSelectionAct: but I haven't learned enough of the infrastructure to add it myself.
I also found that once you doubleClick an unselected list item, it launches the action, selects the list item, but then you can't doubleClick it again for another action.  I found a solution by resetting the port value.

Here's the code that works.

browser := GLMTabulator new.
browser row:#numbers; row:#numbersDoubleClick size:0.1.
browser transmit to: #numbers; andShow:[:a| a list display:[:n| 1to: n]].
browser transmit to: #numbersDoubleClick; from: #numbers port:#strongSelection;
andShow:[:x| (browser portValueAt: (#numbers->#strongSelection)) explore.
browser portValueAt: (#numbers->#strongSelection) put: nil].
browser openOn: 10.

Is there a better way?

Regards,
Sam


Sam S. Adams, CTO - Contextual Computing
IBM Distinguished Engineer, IBM Research
Mobile: 919-696-6064, email: [hidden email]
Assistant: Linda R. Morrison. (720) 395-0460 Fax: (845) 491-4318, Tie: 676-0460, [hidden email]
<<Hebrews 11:6, Proverbs 3:5-6, Romans 1:16-17, 1 Corinthians 1:10>>
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev

Reply | Threaded
Open this post in threaded view
|

Re: Is there an easier way to get equivalent of selectionAct: for double clicks?

Tudor Girba-2
Hi Sam,

First of all thank you for your mail and your enthusiasm. It is exciting to see Moose getting used in unexpected contexts. Could you tell us more about your project? Also, what prompted you to choose Moose?


You are raising a good question.

First, you do not need to create a whole pane to get a new port. Second, you can use a simple transmission that does not show anything. So, your code would be:
browser := GLMTabulator new.
browser row:#numbers.
browser transmit to: #numbers; andShow:[:a| a list display:[:n| 1to: n]].
browser transmit 
to: #numbers port: #x; 
from: #numbers port: #strongSelection; 
when: [ :x | x notNil ];
transformed:[:x| 
x explore. 
((browser paneNamed: #numbers) port: #strongSelection) value: nil ].
browser openOn: 10.


But, the use case is not supported in Glamour explicitly. The reason is that we wanted to focus on data flow rather than on supporting all user interactions possible. So, in your case, if the only thing you want to do is open an explorer, you can see the problem in a different way and instead of wanting to open a window, you pass the value to some pane that happens to show an inspector.

For such a use case, there exist an undervalued feature in Glamour called the Watcher. Try this:

browser := GLMTabulator new.
browser row:#numbers.
browser transmit to: #numbers; andShow:[:a| a list display:[:n| 1to: n]].
browser transmit 
toWatcher; 
from: #numbers port: #strongSelection; 
andShow: [:a :x| a custom: GTInspector new ].
browser openOn: 10.

And then press "Character space command shift" to toggle the Watcher window. You will get a preview window similar to the one on Mac, and if you double click on your list of numbers, the inspector will appear in the watcher (see the attached picture).

As you can see, we turn the problem around a bit. Let me know if it fits your needs.
Inline image 1
Cheers,
Doru



On Wed, Sep 11, 2013 at 4:17 PM, Sam Adams <[hidden email]> wrote:

First, THANKS FOR BREATHING NEW LIFE INTO SMALLTALK!!!!!

We've adopted Pharo/Moose/et.al. for a major project in IBM Research, and as a 29-year Smalltalk veteran, I am simply blown away by all the extreme functionality the community has developed.
In getting used to Glamour, I found a need for a doubleClick action, but the only examples and APIs I could locate used the transmission to update another pane.  I worked out how to do what I need using a "hidden pane", but its an awkward hack.  What I would really like is a strongSelectionAct: but I haven't learned enough of the infrastructure to add it myself.
I also found that once you doubleClick an unselected list item, it launches the action, selects the list item, but then you can't doubleClick it again for another action.  I found a solution by resetting the port value.

Here's the code that works.

browser := GLMTabulator new.
browser row:#numbers; row:#numbersDoubleClick size:0.1.
browser transmit to: #numbers; andShow:[:a| a list display:[:n| 1to: n]].
browser transmit to: #numbersDoubleClick; from: #numbers port:#strongSelection;
andShow:[:x| (browser portValueAt: (#numbers->#strongSelection)) explore.
browser portValueAt: (#numbers->#strongSelection) put: nil].
browser openOn: 10.

Is there a better way?

Regards,
Sam


Sam S. Adams, CTO - Contextual Computing
IBM Distinguished Engineer, IBM Research
Mobile: <a href="tel:919-696-6064" value="+19196966064" target="_blank">919-696-6064, email: [hidden email]
Assistant: Linda R. Morrison. <a href="tel:%28720%29%20395-0460" value="+17203950460" target="_blank">(720) 395-0460 Fax: <a href="tel:%28845%29%20491-4318" value="+18454914318" target="_blank">(845) 491-4318, Tie: 676-0460, [hidden email]
<<Hebrews 11:6, Proverbs 3:5-6, Romans 1:16-17, 1 Corinthians 1:10>>


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev




--

"Every thing has its own flow"

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Is there an easier way to get equivalent of selectionAct: for double clicks?

Ben Coman
In reply to this post by Sam Adams-2
Sam Adams wrote:
> First, THANKS FOR BREATHING NEW LIFE INTO SMALLTALK!!!!!
>
>  
Hi Sam, welcome to the list.

I don't have an answer for you question, but as a sidebar, you might
find Pharo Vision [1] an interesting read, if you have not seen it already.

[1]
http://www.pharo-project.org/download/pictures/be/j32hajf3kjdbsebqo0a9zc5tk8ekxt/pharovision.pdf

cheers -ben

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Is there an easier way to get equivalent of selectionAct: for double clicks?

Stéphane Ducasse
In reply to this post by Sam Adams-2
Thanks Sam. Our goal with Pharo/Moose … is indeed to be able to reinvent Smalltalk :)

I would love to be able to get a news that IBM is using Pharo and Moose. It would be so good for our public image. Could you let us more about your project?

Stef



On Sep 11, 2013, at 4:17 PM, Sam Adams <[hidden email]> wrote:

First, THANKS FOR BREATHING NEW LIFE INTO SMALLTALK!!!!!

We've adopted Pharo/Moose/et.al. for a major project in IBM Research, and as a 29-year Smalltalk veteran, I am simply blown away by all the extreme functionality the community has developed.
In getting used to Glamour, I found a need for a doubleClick action, but the only examples and APIs I could locate used the transmission to update another pane.  I worked out how to do what I need using a "hidden pane", but its an awkward hack.  What I would really like is a strongSelectionAct: but I haven't learned enough of the infrastructure to add it myself.
I also found that once you doubleClick an unselected list item, it launches the action, selects the list item, but then you can't doubleClick it again for another action.  I found a solution by resetting the port value.

Here's the code that works.

browser := GLMTabulator new.
browser row:#numbers; row:#numbersDoubleClick size:0.1.
browser transmit to: #numbers; andShow:[:a| a list display:[:n| 1to: n]].
browser transmit to: #numbersDoubleClick; from: #numbers port:#strongSelection;
andShow:[:x| (browser portValueAt: (#numbers->#strongSelection)) explore.
browser portValueAt: (#numbers->#strongSelection) put: nil].
browser openOn: 10.

Is there a better way?

Regards,
Sam


Sam S. Adams, CTO - Contextual Computing
IBM Distinguished Engineer, IBM Research
Mobile: 919-696-6064, email: [hidden email]
Assistant: Linda R. Morrison. (720) 395-0460 Fax: (845) 491-4318, Tie: 676-0460, [hidden email]
<<Hebrews 11:6, Proverbs 3:5-6, Romans 1:16-17, 1 Corinthians 1:10>>

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev