Pictures sequenzes Probleme :-((.
Lic. Edgar J. De Cleene
edgardec2001 at yahoo.com.ar
Wed Mar 29 21:10:32 UTC 2006
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
More information about the Squeak-dev
mailing list
|