<div dir="ltr"><div>Hi,</div><div>A morph has to be in the world to be able to interact with it; eg. #openInWorld.<br></div><div><br></div><div>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.<br></div><div>To see the morph again send #show.</div><div>To delete the morph send #delete. The morph will be garbage collected.<br></div><div><br></div><div>Best,</div><div>Karl<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 21, 2023 at 11:57 PM Eduardo Ochs <<a href="mailto:eduardoochs@gmail.com">eduardoochs@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi Vanessa!<br>Thanks! =) This works in a workspace,<br><br>  "Create a SimpleSwitchMorph with label 'Toggle'<br>      and a SimpleButtonMorph with label 'Flash'.<br>      The button will be placed below the switch."<br>  <br>  sm := SimpleSwitchMorph new.<br>  sm openInWorld.<br>  bm := SimpleButtonMorph new.<br>  bm openInWorld.<br>  bm position: bm position + (0@32).<br>  <br>  "Three ways of toggling the color of the switch:"<br>  <br>  sm toggleState.<br>  <br>  bl := [ sm toggleState ].<br>  bl value.<br>  <br>  bm target: bl.<br>  bm actionSelector: #value.<br>  bm doButtonAction.<br>  <br>  "Two ways of toggling the switch after 1000ms:"<br>  <br>  sm addAlarm: #toggleState after: 1000.<br>  bm addAlarm: #doButtonAction after: 1000.<br><br>but this doesn't:<br><br>  bm2 := SimpleButtonMorph new.<br>  bm2 target: bl.<br>  bm2 actionSelector: #value.<br>  bm2 addAlarm: #doButtonAction after: 1000.<br><br>What is the right way to add an alarm to a morph that is not shown on<br>the screen? Also, can I create a new invisible morph every time that I<br>want to run an alarm? Are they going to be garbage collected?<br><br>  Thanks in advance!<br>    Eduardo Ochs<br>    <a href="http://anggtwu.net/eev-squeak.html" target="_blank">http://anggtwu.net/eev-squeak.html</a><br></div><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 21 Feb 2023 at 02:16, Vanessa Freudenberg <<a href="mailto:vanessa@codefrau.net" target="_blank">vanessa@codefrau.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>The best way to do this in Morphic is with "alarms":</div><div><br></div><div>    self addAlarm: #changeKeyboardFocus after: 5000.<br></div><div><br></div><div>which would execute the morph's changeKeyboardFocus method 5 seconds later.</div><div><br></div><div>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).</div><div><br></div><div>Vanessa</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 20, 2023 at 8:49 PM Eduardo Ochs <<a href="mailto:eduardoochs@gmail.com" target="_blank">eduardoochs@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi list,<br><br>a few days ago I asked for help on how to send a "synthetic" keyboard<br>event to a morph, and Karl Ramberg gave me exactly the right hints in<br>this thread:<br><br><a href="http://lists.squeakfoundation.org/pipermail/squeak-dev/2023-February/223473.html" target="_blank">http://lists.squeakfoundation.org/pipermail/squeak-dev/2023-February/223473.html</a><br><br>My code is ready except for documentation and comments - I'll work on<br>that in the next few days and then post the result here and on the<br>wiki...<br><br>...but there's a feature that I want to add to it that - again =( -<br>needs something that I'm not being able to discover by myself. How do<br>I write a line of code that waits for 5 seconds, sort of like running<br>"sleep 5" in a shell, and that doesn't block the rest of the system?<br>If I have that I'll be able to run these two lines in a workspace,<br><br>  self mySleep: 5000.<br>  kf := self currentHand keyboardFocus.<br><br>switch the keyboard focus to something else by clicking on it, and<br>then the variable kf will be set to this "something else"...<br><br>Thanks in advance!<br>  Eduardo Ochs<br>  <a href="http://anggtwu.net/eev-squeak.html" target="_blank">http://anggtwu.net/eev-squeak.html</a><br><div><br></div></div>
<br>
</blockquote></div></div>
<br>
</blockquote></div></div>
<br>
</blockquote></div>