Hi,
I have a little problem, I want to change the time by a "ClockMorph" Instance, I have searched a Methode in Squeak Categorie ClockMorph, which makes that, but I didn't find. for exemple of this way:" I get the contents of my clockMoprh, then I set these contents with the time that I want", is there a methode that make that, or I must writte it self. |b| a := ClockMorph new. a showSeconds:false. b:=a getCharacters. a setCharacters:b with:'19:23'.---------------I want to have a Methode like that....so I can change the time.------ a openInWorld. Thanks all for Help, Thanks Edgar. Radouane. ___________________________________________________________________________ Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com |
On 6/5/06, radouane el marjani <[hidden email]> wrote:
> I want to change the time by a "ClockMorph" A ClockMorph displays the current system time. Do you mean to say that you want to change your system's idea of the time? That's probably not advisable, even if it's possible. But I think you're wanting to make your own "clock" that could be set to any time you'd like, perhaps? You probably want to make your own object, similar to a ClockMorph, but which displays your chosen time instead of the system time. It may be useful to make an underlying model object which tracks the time, which a separate (Morph-descended) object simply displays, and perhaps changes. Hope this helps! --Tom Phoenix |
In reply to this post by radouane el marjani
On 6/5/06, radouane el marjani <[hidden email]> wrote:
Hi, You can see how ClockMorph gets its content from the ClockMorph>>step method. Right now, it's hard-coded to use 'Time now'. You could get the functionality you want by adding a new instance variable, 'time', and a new method 'time:' that'll set the variable. Remember to set it to Time now in ClockMorph>>initialize too. Duncan. |
On 6/5/06, Duncan Mak <[hidden email]> wrote:
Come to think of it, this will only work if you use blocks, because everytime step is called, a new Time needs to be calculated. Duncan. |
In reply to this post by radouane el marjani
radouane el marjani puso en su mail :
> Hi, > Thanks for your answer, I have thinking the same. I will try another > way, I think. > > Radouane I see someone on list suggest you do a subclass of StringMorph for doing what you wish. You could add in class side authoringPrototype: aString ^ super authoringPrototype contents: (Time fromString: aString) printString And in step you could explore Stopwatch class for see if you could combine and have some StringMorph subclass: #DiferentClockMorph instanceVariableNames: 'showSeconds show24hr' classVariableNames: '' poolDictionaries: '' category: 'MorphicExtras-Demo' What you copy from ClockMorph and could suit your taste. Could explain some more what you wish do ? Edgar ___________________________________________________________ 1GB gratis, Antivirus y Antispam Correo Yahoo!, el mejor correo web del mundo http://correo.yahoo.com.ar |
Free forum by Nabble | Edit this page |