Pictures sequenzes Probleme :-((.

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

Pictures sequenzes Probleme :-((.

radouane el marjani
Hi,
I need your help, I have 3 pictures produced as "SketchMorphs".
Now I want by using the Metohdes "startStopping" and "step" create
sequenzes of these pictures.
First I will see the picture "a", I want click on and il must coming
pictures b then c. but that don't work.
I would apreciate your help and I will writte my code below:

-------------------------------------------------

Morph subclass: #Test
    instanceVariableNames: 'a b c path array'
    classVariableNames: 'TestMorph'
    poolDictionaries: ''
    category: 'testRadouane'
-----------------------------------------------------
initializedisplays

a := SketchMorph fromFile: 'bilder\display\display.gif'.
b:=    SketchMorph fromFile: 'bilder\display\nachrichten.gif'.
c:=    SketchMorph fromFile: 'bilder\display\telefonbuch.gif'.

array:=Array new:3.
array at:1 put:a.
array at:2 put:b.
array at:3 put:c
-------------------------------------------------------------
startAnimation

    path := OrderedCollection new.
    2 to: 3 do: [:i | path add: (array at:i)].
    path inspect.
   
    self startStepping.
-----------------------------------------------------------------
step
 path := OrderedCollection new.
    2 to: 3 do: [:i | path add: (array at:i)].
    path inspect.
 
    path size > 0 ifTrue: [
    a addMorphFront: path removeFirst.
    a openInWorld.].
------------------------------------------------------------------
stepTime

^50
-------------------------------------------------------------------
initialize
super initialize.
self initializedisplays.
a openInWorld.
a
        on: #mouseDown
        send: #startAnimation
        to: self.
------------------------------------------------------------------------
Now I tip in Workspace as below:
test _Test new
--------------------------------------------------------------------------
I can see  the first pictur  but beim clicken on this Photo, it will not
so working as I want!!!:-(
Have someone an idea.
Thanks for your help,
Radouane.

       

       
               
___________________________________________________________________________
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.
Téléchargez sur http://fr.messenger.yahoo.com

Reply | Threaded
Open this post in threaded view
|

Re: Pictures sequenzes Probleme :-((.

Edgar J. De Cleene
radouane el marjani puso en su mail :

> Hi,
> I need your help, I have 3 pictures produced as "SketchMorphs".
> Now I want by using the Metohdes "startStopping" and "step" create
> sequenzes of these pictures.
> First I will see the picture "a", I want click on and il must coming
> pictures b then c. but that don't work.
> I would apreciate your help and I will writte my code below:

I see you don't have any mouse events in your code.

See click: / doubleClick: / handlesMouseDown / mouseDown events in Morph.

Also you could use ImageMorph as your mother class

I add a old code what I hope could be useful to you.
It's only a part, but try to follow how you could load any picture format
what understand Squeak, have a miniature of it, see the picture to normal
size by clicking, etc.

Sorry some is in Spanish and if you need more, send private mail .

Edgar

ImageMorph subclass: #MiFotoMiniatura
    instanceVariableNames: 'index '
    classVariableNames: ''
    poolDictionaries: ''
    category: 'PobrePoint'!

!MiFotoMiniatura methodsFor: 'accessing' stamp: 'edc 9/29/2003 09:34'!
index
    "Answer the value of index"

    ^ index! !

!MiFotoMiniatura methodsFor: 'accessing' stamp: 'edc 9/29/2003 09:34'!
index: anObject
    "Set the value of index"

    index _ anObject! !


!MiFotoMiniatura methodsFor: 'menu commands' stamp: 'edc 10/2/2003 08:48'!
rotarCCW
    | f |
    f _ self image rotateBy: #left centerAt: self center.
    self image: f.
    self redraw! !

!MiFotoMiniatura methodsFor: 'menu commands' stamp: 'edc 3/25/2004 10:36'!
verOriginal
    | s |
    s _ MiStack allInstances last.
   
    s isInWorld
        ifTrue: [s loadImage: self index]! !


!MiFotoMiniatura methodsFor: 'menus' stamp: 'edc 8/22/2002 11:30'!
addCustomMenuItems: aCustomMenu hand: aHandMorph
    "Include our modest command set in the ctrl-menu"
    super addCustomMenuItems: aCustomMenu hand: aHandMorph.
    aCustomMenu addLine.
    self addMenuItemsTo: aCustomMenu hand: aHandMorph! !

!MiFotoMiniatura methodsFor: 'menus' stamp: 'edc 10/1/2003 10:22'!
addMenuItemsTo: aMenu hand: aHandMorph
    | menu |
    menu _ MenuMorph new.
    menu
        color: (Color
                r: 0.4
                g: 0.4
                b: 0.4).
    menu
        color: (menu color alpha: 0.5).
    menu
        add: 'rotar contra reloj '
        target: self
        action: #rotarCCW.
    menu
        add: 'rotar sentido reloj '
        target: self
        action: #rotarCW.
menu
        add: 'ver Original '
        target: self
        action: #verOriginal.
    menu items
        do: [:i | i color: Color red;
               
                font: (StrikeFont
                        familyName: 'Comic Bold'
                        size: 12
                        emphasized: 1)].
    menu invokeModal! !

!MiFotoMiniatura methodsFor: 'menus' stamp: 'edc 10/2/2003 07:12'!
initializarCon: unaImagen numero: unEntero
    | rect text f frame |
    f _ Form fromFileNamed: unaImagen.
    f _ f scaledToSize: 80 @ 60.
    self image: f.
    self index: unEntero.
    rect _ RectangleMorph authoringPrototype useRoundedcorners
                color: (Color
                        r: 0.4
                        g: 0.4
                        b: 0.4
                        alpha: 0.5);
                 borderWidth: 2.
    text _ TextMorph new contents: unEntero asString;
                 textColor: Color red;
                 fontName: #ComicBold size: 9.
    rect extent: text extent + (8 @ 6) asPoint.
    frame _ LayoutFrame new.
    frame leftFraction: 0.5 offset: text width // -2.
    frame topFraction: 0 offset: 0.
    text layoutFrame: frame.
    rect layoutPolicy: ProportionalLayout new.
    rect addMorph: text.
   
    rect openInWorld.
    rect topLeft: self bottomLeft.
    self addMorph: rect.
    self openInWorld! !

!MiFotoMiniatura methodsFor: 'menus' stamp: 'edc 10/2/2003 08:49'!
redraw
    | m |
    m _ submorphs at: 1.
    self
        privateRemoveMorph: (submorphs at: 1).
    m topLeft: self bottomLeft.
    self addMorph: m.
    ! !

!MiFotoMiniatura methodsFor: 'menus' stamp: 'edc 10/2/2003 08:51'!
rotarCW
    | f |
    f _ self image      rotateBy: #right centerAt: self center.
    self image: f.
    self redraw! !


!MiFotoMiniatura methodsFor: 'event handling' stamp: 'edc 10/1/2003 09:24'!
handlesMouseDown: anEvent
    ^ Smalltalk isMorphic not
        or: [anEvent yellowButtonPressed]! !

!MiFotoMiniatura methodsFor: 'event handling' stamp: 'edc 10/1/2003 10:21'!
mouseDown: evt
    evt yellowButtonPressed
        ifTrue: [self processYellowButton: evt]
        ifFalse: [^ evt hand waitForClicksOrDrag: self event: evt]! !

!MiFotoMiniatura methodsFor: 'event handling' stamp: 'edc 10/1/2003 09:48'!
processYellowButton
    | s |
    s _ MiStack allInstances
        detect: [:each | each world == ActiveWorld].
s loadImage: self index! !

!MiFotoMiniatura methodsFor: 'event handling' stamp: 'edc 10/1/2003 10:21'!
processYellowButton: evt
| menu |
menu _ MenuMorph new defaultTarget: self.
            self addMenuItemsTo: menu hand: evt hand.
            menu popUpEvent: evt in: self world.! !

!MiStack methodsFor: 'accessing' stamp: 'edc 3/25/2004 09:40'!
mostrarMiniaturas
    | listaArchivos aSuffixList photo maxSize |
    maxSize _ self extent.
    slash _ FileDirectory slash.
    aSuffixList _ #('bmp' 'gif' 'jpg' 'jpeg' 'form' 'png' ).
    listaArchivos _ Orderedcollection new.
    aSuffixList
        do: [:aSuffix | listaArchivos
                addAll: (directorio fileNamesMatching: '*' , aSuffix)].
    listaArchivos
        do: [:archivo |
            photo _ MiFotoMiniatura new initializarCon: directorio pathName
, slash , archivo numero: index.
            self index: self index + 1.
            self addMorphBack: photo.
            ActiveWorld displayWorld.
            photo bottomRight x > maxSize x | (photo bottomRight y > maxSize
y)
                ifTrue: [photo privateDelete.
                    ^ self]]! !


__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar