Hi,

Sometimes we have to show large text files and Pharo takes some time to get their contents and display them. In a Glamour browser, for example, the user would click and then wait for a few seconds before he'll get the desired results. In such cases, it will be useful to show the user a certain text in the text presentation, and once the contents of the file are available, the presentation updates itself with it (something on the lines of Cursor>>showWhile:)

Conceptually, with Glamour this can be achieved in two ways: triggering two transmissions for the text display pane and updating the text presentation when file contents are available.

Triggering transmission (or placing values manually in entity/selection ports) means that if the pane contains multiple presentations, each one will get affected the "delayed" behaviour even when there is none.

Updating the text presentation is better suited. Something like:

| tab textDisplayBlock|
tab := GLMTabulator new.
tab title: 'Playing with huge text files'.
tab column: #list span: 0.5; column:[:c | c row: #code; row: #details].
textDisplayBlock := [ :each | 'Loading file ...' ].
tab transmit to:#list; andShow: [:a | 
a list display: #yourself].
tab transmit to:#code; from:#list; andShow: [:a | 
a rubricText 
display: textDisplayBlock.
a roassal2 painting: [ :view :entity | view add: (((RTBox new color: Color red) + RTLabel) elementOn: entity) ]
].
tab transmit to:#details; from:#list; andShow: [:a | 
a rubricText 
display: #yourself.
].
tab openOn: RubLipsumBasicExample selectors.
"I just displayed text presentation, you can provide me the alternate block"
textDisplayBlock:= [:each |  (RubLipsumBasicExample sourceCodeAt: each)].
tab update.


But this has to be done with Announcements not to introduce a specific delay each time and outside browser interpretation loop so that the pane is visible during the file reading operation. I haven't found so far how to change the display behaviour of a presentation from an announcement raised by an object outside the browser/presentation like:
on: FileContentsAvailable do: [block := textDisplayBlock:= [:each |  (RubLipsumBasicExample sourceCodeAt: each)]. browser update]

So my questions: am I trying achieve something glamour does not support (yet)? Can we add a generic showWhile: mechanism for Glamour textual presentations without too much effort? Or there is a simple way to achieve it that I don't see?

tx,
usman