[Q][presentation] Slide-show of projects
Hannes Hirzel
hirzel at spw.unizh.ch
Sat Feb 23 10:26:07 UTC 2002
On Thu, 21 Feb 2002, Bob Arning wrote:
> On Thu, 21 Feb 2002 15:36:17 +0100 (MET) Hannes Hirzel <hirzel at spw.unizh.ch> wrote:
> >I tried a simple code snippet to get a slide show of the projects I have
> >in an image. Actually I put the code below into a class method I call from
> >the world's personal menu.
> >
> >
> >[Project allNames do: [ :n |
> >(Project named: n) enter. (Delay forMilliseconds: 5000) wait]] fork
> >
> >
> >But it did not work. Just one project was opened and then it stopped.
> >
> >Does anybody have a suggestion for a solution?
>
> Hannes,
>
> Try this:
>
> First filein this
> ---------------------------------------------------------------------------------------------------
> 'From Squeak3.3alpha of 28 January 2002 [latest update: #4736] on 21 February 2002 at 8:57:54 pm'!
>
> !Collection methodsFor: 'testing' stamp: 'RAA 2/21/2002 20:57'!
> enterNextProject
>
> | tempProject m p |
>
> self isEmpty ifTrue: [^self].
> tempProject _ Project named: self first.
> (m _ DoCommandOnceMorph new)
> color: Color transparent;
> borderColor: Color transparent;
> extent: 1 at 1;
> borderWidth: 0;
> actionBlock: [
> p _ Project current projectParameters.
> p at: #armsLengthCmd ifPresent: [ :morph | morph delete].
> p removeKey: #armsLengthCmd ifAbsent: [].
> (Delay forMilliseconds: 1000) wait.
> self allButFirst enterNextProject.
> ].
> tempProject projectParameters
> at: #armsLengthCmd
> put: m.
> tempProject enter.
> ! !
> ---------------------------------------------------------------------------------------------------
>
> Then do this:
>
> ---------------------------------------------------------------------------------------------------
> (Project allNames copyWithout: Project current name) enterNextProject
> ---------------------------------------------------------------------------------------------------
>
Thank you Bob, this worked fine!
You create a method #enterNextProject in the collection protocol and apply
it to the collection you get by
Project allNames.
Before entering a new project you create a DoCommandOnceMorph and put
it with the key #armsLengthCmd in a dictionary
tempProject projectParameters.
I understand that I can adapt the actionBlock to do other things.
One for example is to do
Sensor peekButtons
and if a mousebutton is pressed to stop going further.
My question (out of curiosity because I'd like to understand the
code fully): How is the DoCommandOnceMorph activated
when the project is entered?
Regards
Hannes
More information about the Squeak-dev
mailing list
|