[squeak-dev] Dependencies on Cursor

tim Rowledge tim at rowledge.org
Tue Jun 25 17:42:11 UTC 2013


On 25-06-2013, at 8:52 AM, Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com> wrote:

> But can we agree that File should not bother with UI things, it's not it's business, be it by direct access to Cursor, or indirect access thru a UIManager?
> 
> 
> 2013/6/25 Frank Shearar <frank.shearar at gmail.com>
> On 25 June 2013 16:35, Nicolas Cellier
> <nicolas.cellier.aka.nice at gmail.com> wrote:
> > That reminds me the post from Travis Griggs, citing ideas from Vassili Bykov

That's a pile of good comment right there. Using the cursor all the time was easy and effective when you had very little other choice. We had some discussions a while back about making buttons provide some 'temporarily busy' feedback and part of that was about avoiding cursor changing even within UI code. Non-UI code really ought not ever make cursor changes. The best thing to do in my experience is to use a signal of some variety; an actual Exception might be suited to many cases but other notification mechanisms are possible. Why, we even have some good uses as examples -
ProgressMorph, which appears to be unused
String>displayProgress*, which is doing the right kind of thing whilst still being overly tied to UI details
ProgressInitiationException, which is used by String>displayProgress

It seems to me that a slightly more abstract exception would be sensible, so that code might read a bit like this:-

  
foo: thing
"do something that might take a while; alert the UI stuff and keep letting the user know things are ok"
  self prepareForArmageddon.
  ProgressNotificationAlert initialNotification.
 "this part is done in discrete steps"
  listOfStuff do:[wotsit|
        wotsit thungummy.
       ProgressNotificationAlert notifiyStepPercentage: wotsit size].
  "this bit may take any amount of time, so use a generic beachball/spinner/ticker thing"
 ProgressNotificationAlert notifyLongJob.
 thing peformMagicTricks.
 ProgressNotificationAlert terminateAlert

There's plenty of scope for debating the details of whether we ought to put the code in handler block like constructs or whatever. How little code could we make the user have to write? Maybe it could work as simply as the current Cursor message:-

foo: thing
   ProgressNotificationAlert while:[
            self prepareForArmageddon.
            listOfStuff do:[wotsit|
                     wotsit thungummy].
             thing peformMagicTricks]




tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Strange OpCodes: NNI: Neglect Next Instruction




More information about the Squeak-dev mailing list