On Tue, Sep 16, 2014 at 1:58 PM, Yuriy Tymchuk <[hidden email]> wrote:
Ditto. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
In reply to this post by Tudor Girba-2
Hi Doru,
On 09/14/2014 11:52 PM, Tudor Girba wrote: > Hi, > > > > On Sun, Sep 14, 2014 at 10:45 PM, Offray Vladimir Luna Cárdenas > <[hidden email] <mailto:[hidden email]>> wrote: [...] > > The main conceptual issue I have is that most of the examples I see on the > Deep into Pharo and Moose Books on custom browsers are mapping the flow of > information in transmissions in one sense from general to particular: > packages to classes -> to protocols -> to methods -> to code editor, > > > This is incorrect. Transmissions handle any data between any ports. > Nice to know. What I'm pointing is that documentation only shows flux from general to particular and not the other way around. [...] > > > You do not send messages. You send data from one port to another, and > presentations react to the changes of port values from the panes in which they > reside. The outside port is just another port in the surrounding pane. You can > choose any port for any pane you want. > Thanks for the explanation. I understand it better. [...] > > > For text being updated, you have this. The port is called #text. > > Here is an updated example of how to store the text as it is being written by > using the block of a transmission: > > objectStoringTheText := ''. > tabulator := GLMTabulator new. > tabulator column: #pane. > tabulator transmit > to: #pane; > andShow: [ :a | a text ]. > tabulator transmit > from: #pane port: #text; > to: #pane port: #portIDoNotCareAbout; > transformed: [ :textComingFromThePresentation | objectStoringTheText := > textComingFromThePresentation ]. > tabulator openOn: text > > In this case, objectStoringTheText is the object with which you can do what you > want. In this case, in the transformed: block, I simply store the text in it as > an example. > > To test this example, just execute the code in a Moose image, then type > something, and then inspect objectStoringTheText. You will see that it has the > text that you typed. > > Is this clearer now? > > Cheers, > Doru > Yes, is clearer. I would like to start with kind of a most basic browser, to send information back and forward. Consider this: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | browser dict | dict := Dictionary new. dict at: 1 put: 'uno'. dict at: 2 put: 'dos'. browser := GLMTabulator new title: 'Minimal test'. browser column: #keys; column: #values. browser transmit to: #keys; andShow: [:k | k list display: #keys ]. browser transmit from: #keys; to: #values; andShow: [:v | v text display: #value ]. browser openOn: dict =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Now I have a two panes browser trying to show pairs in a dictionary. In fact, I said "trying" because I get the key twice. So my questions starting from there are: 1. How to show in the #values column the values of the dict once you have selected the specific key in the #keys column? 2. How to get any update in the #values column as an updated value in the dictionary using ports and transformed messages. Thanks, Offray _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Hi,
First, thanks On Tue, Sep 16, 2014 at 6:30 PM, Offray Vladimir Luna Cárdenas <[hidden email]> wrote:
In the second transmission, you specify how to carry the value over to the values pane and then you specify how to display the text. display: takes a block. If you pass a symbol, it is equivalent to sending the unary message to the entity object. So, in your case, you can just do this: | browser dict | dict := Dictionary new. dict at: 1 put: 'uno'. dict at: 2 put: 'dos'. browser := GLMTabulator new title: 'Minimal test'. browser column: #keys; column: #values. browser transmit to: #keys; andShow: [:k | k list display: #keys ]. browser transmit from: #keys; to: #values; andShow: [:v | v text display: [ :key | dict at: key ] ]. browser openOn: dict Or you can work by passing around the association (so, an object that holds more information and that does not require you to use the dict external object). | browser dict | dict := Dictionary new. dict at: 1 put: 'uno'. dict at: 2 put: 'dos'. browser := GLMTabulator new title: 'Minimal test'. browser column: #keys; column: #values. browser transmit to: #keys; andShow: [:k | k list display: [:d | d associations ]; format: [:assoc | assoc key asString] ]. browser transmit from: #keys; to: #values; andShow: [:v | v text display: [ :assoc | assoc value asString ] ]. browser openOn: dict 2. How to get any update in the #values column as an updated value in the dictionary using ports and transformed messages. In this case, you need an external object that will hold the side effect. So, you can turn the first example into: | browser dict | dict := Dictionary new. dict at: 1 put: 'uno'. dict at: 2 put: 'dos'. browser := GLMTabulator new title: 'Minimal test'. browser column: #keys; column: #values. browser transmit to: #keys; andShow: [:k | k list display: #keys ]. browser transmit from: #keys; to: #values; andShow: [:v | v text display: [ :key | dict at: key ] ]. browser transmit from: #values port: #entity; from: #values port: #text; when: [ :key :text | text notNil ]; to: #values port: #nirvana; transformed: [ :key :text | dict at: key put: text ]. browser openOn: dict How is this? Cheers, Doru "Every thing has its own flow"
_______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Free forum by Nabble | Edit this page |