[squeak-dev] How do I "sleep 5"?
marcel.taeumel at hpi.de
Fri Feb 24 09:02:59 UTC 2023
Hi Benoit --
> Nothing prevents us from replacing Morphic or redesigning it!
Well, common sense does. ;-) Unless we make this a serious discussion considering Pros and Cons, such hasty thoughts will get us nowhere. From what I have read so far, I assume, that you have no substantial experience in writing Morphic applications? I don't know. Sorry, if my conclusion offended you. Your kind of shallow call just triggered something... :-/
> [...] what's stopping us from even considering that option?
Maybe because us frequent users of Squeak/Morphic have already realized that both Cuis and Pollock are just different and not inherently better? Well, I don't know about Pollock. Cuis has different goals, backwards compatibility may not be among its most important ones.
It's not that difficult to come up with something different. The first weeks might be even fun. After that, you figure out all the corner cases and start arguing about compatibility and finding balance within the existing community. It is hard work. It is easy to ignore this fact in the beginning.
Am 24.02.2023 05:47:30 schrieb Benoit St-Jean via Squeak-dev <squeak-dev at lists.squeakfoundation.org>:
Nothing prevents us from replacing Morphic or redesigning it!
If Juan was able to do it for Cuis and Sam Shuster was able to design Pollock for VW, what's stopping us from even considering that option?
On 2023-02-23 20:14, Stephen Travis Pope wrote:
Sounds like yet another reason to drop morphic, if you ask me, and go back to good-old MVC…
Stephen Travis Pope Ojai, California, USA
On Feb 23, 2023, at 1:54 PM, Vanessa Freudenberg <vanessa at codefrau.net> [mailto:vanessa at codefrau.net] wrote:
Because Morphic is not multi-thread-clean, you have to be really careful how to write the do_something to be reliably executed from a different process. You have to coordinate with the UI process. In which case it actually becomes simpler to just stay in the UI process and use the mechanisms available.
On Thu, Feb 23, 2023 at 11:38 AM Stephen Travis Pope <stephen at heaveneverywhere.com [mailto:stephen at heaveneverywhere.com]> wrote:
I’ve been watching this thread and wondering why nobody suggests the simplest answer:
[(Delay forSeconds: 5) wait.
Stephen Travis Pope Ojai, California, USA
On Feb 22, 2023, at 11:16 AM, karl ramberg <karlramberg at gmail.com [mailto:karlramberg at gmail.com]> wrote:
On Wed, Feb 22, 2023 at 8:47 AM Taeumel, Marcel via Squeak-dev <squeak-dev at lists.squeakfoundation.org [mailto:squeak-dev at lists.squeakfoundation.org]> wrote:
(bm2 future: 1000) doButtonAction.
Also works for objects that are not or cannot be in the world.
Uses Morphic alarms when when in UI process.
Ah, that's cool. I never used #future: :-)
From: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org [mailto:squeak-dev-bounces at lists.squeakfoundation.org]> on behalf of Eduardo Ochs <eduardoochs at gmail.com [mailto:eduardoochs at gmail.com]>
Sent: Wednesday, February 22, 2023 7:17:01 AM
To: The general-purpose Squeak developers list <squeak-dev at lists.squeakfoundation.org [mailto:squeak-dev at lists.squeakfoundation.org]>
Subject: Re: [squeak-dev] How do I "sleep 5"?
Fantastic, thanks! =)
I added this to the class in which I'm putting most of my stuff,
!See class methodsFor: 'as yet unclassified' stamp: 'Edrx 2/22/2023 02:54'!
run: aBlock after: ms
| aButton |
aButton := SimpleButtonMorph new.
addAlarm: #doButtonAction after: ms.
and now I can simply run this
See run: [ kf := self currentHand keyboardFocus ] after: 5000.
to save into the variable kf the morph on which the keyboard focus is
after 5 seconds. Neat! =)
On Wed, 22 Feb 2023 at 01:56, karl ramberg <karlramberg at gmail.com [mailto:karlramberg at gmail.com]> wrote:
A morph has to be in the world to be able to interact with it; eg. #openInWorld.
If you don't want to see the morph you can send it message #hide. It makes the morph invisible but it's still in the world and can interact with it.
To see the morph again send #show.
To delete the morph send #delete. The morph will be garbage collected.
On Tue, Feb 21, 2023 at 11:57 PM Eduardo Ochs <eduardoochs at gmail.com [mailto:eduardoochs at gmail.com]> wrote:
Thanks! =) This works in a workspace,
"Create a SimpleSwitchMorph with label 'Toggle'
and a SimpleButtonMorph with label 'Flash'.
The button will be placed below the switch."
sm := SimpleSwitchMorph new.
bm := SimpleButtonMorph new.
bm position: bm position + (0 at 32).
"Three ways of toggling the color of the switch:"
bl := [ sm toggleState ].
bm target: bl.
bm actionSelector: #value.
"Two ways of toggling the switch after 1000ms:"
sm addAlarm: #toggleState after: 1000.
bm addAlarm: #doButtonAction after: 1000.
but this doesn't:
bm2 := SimpleButtonMorph new.
bm2 target: bl.
bm2 actionSelector: #value.
bm2 addAlarm: #doButtonAction after: 1000.
What is the right way to add an alarm to a morph that is not shown on
the screen? Also, can I create a new invisible morph every time that I
want to run an alarm? Are they going to be garbage collected?
Thanks in advance!
On Tue, 21 Feb 2023 at 02:16, Vanessa Freudenberg <vanessa at codefrau.net [mailto:vanessa at codefrau.net]> wrote:
The best way to do this in Morphic is with "alarms":
self addAlarm: #changeKeyboardFocus after: 5000.
which would execute the morph's changeKeyboardFocus method 5 seconds later.
The way of sleeping you suggest is possible too but more tricky, since you would have to move your wait code to an extra process to not block the UI process, but then make sure that the actual work is done in the UI process again (Morphic is not multithreaded, although Squeak is).
On Mon, Feb 20, 2023 at 8:49 PM Eduardo Ochs <eduardoochs at gmail.com [mailto:eduardoochs at gmail.com]> wrote:
a few days ago I asked for help on how to send a "synthetic" keyboard
event to a morph, and Karl Ramberg gave me exactly the right hints in
My code is ready except for documentation and comments - I'll work on
that in the next few days and then post the result here and on the
...but there's a feature that I want to add to it that - again =( -
needs something that I'm not being able to discover by myself. How do
I write a line of code that waits for 5 seconds, sort of like running
"sleep 5" in a shell, and that doesn't block the rest of the system?
If I have that I'll be able to run these two lines in a workspace,
self mySleep: 5000.
kf := self currentHand keyboardFocus.
switch the keyboard focus to something else by clicking on it, and
then the variable kf will be set to this "something else"...
Thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev