Hi there,<br><br>As mentioned before, your class would have to inherit the method handleKeytroke:, keyStroke: and keyDown: inside which you then decide what should be done. However, in order to find out which key has been pressed, you will have to find out the corresponding ASCII code, and then check if the pressed ASCII code is the same as the one you want to monitor.<br>
<br>x := Sensor keyboardPeek asciiValue.<br>(x == 99) &quot;99 is the ascii value for the letter c&quot;<br>ifTrue: [Transcript show: &#39;letter c was pressed&#39;; cr].<br><br>If this is implemented in the keyDown: method, everytime the c key is pressed, the Transcript should show the text specified.<br>
<br>You can find the ASCII values for each key on <a href="http://www.asciitable.com">www.asciitable.com</a> . In the image on the page, the ASCII value is the one in the Dec column.<br><br>Displaying an image is fairly easy, as long as Squeak supports the format. Current supported formats are GIF, JPG, PNG and BMP if I remember correctly. To use an image inside any morph or in the world, use this:<br>
<br>x := ImageMorph new.<br>x image: (Form fromFileNamed: &#39;path/to/your/image.jpg&#39;).<br>x openInWorld.<br><br>This will load the specified file, create the necessary form, and is then opened in your current world.<br>
<br>I hope this helps a bit,<br><br>Marcus<br><br><br><br>&gt; Message: 1<br>
&gt; Date: Mon, 7 Apr 2008 14:44:32 -0700 (PDT)<br>
&gt; From: kennellgr &lt;<a href="mailto:cboneg5@gmail.com">cboneg5@gmail.com</a>&gt;<br>
&gt; Subject: [Newbies] I am a total beginner with some questions<br>
&gt; To: <a href="mailto:beginners@lists.squeakfoundation.org">beginners@lists.squeakfoundation.org</a><br>
&gt; Message-ID: &lt;<a href="mailto:16540965.post@talk.nabble.com">16540965.post@talk.nabble.com</a>&gt;<br>
&gt; Content-Type: text/plain; charset=us-ascii<br>
<br>
<br>
&gt; I really like programming (I&#39;ve done some in C) and I decided I wanted to try<br>
&gt; doing some programming on my Mac. I spent hours online trying to find<br>
&gt; something that I could learn and settled on Squeak. I have it and barely<br>
&gt; understand the basics of it.<br>
<br>&gt; A few Questions:<br>
<br>
&gt; 1. What do I do to test whether or not a key has been pressed (in a method I<br>
&gt; want it to say &#39;if C key is pressed down do this&#39;)<br>
<br>
&gt; 2. What do I do to display a picture that I have on my computer?<br clear="all"><br>-- <br>iMac -- 20 inch -- Core 2, 2 GHz -- 1 GB RAM -- Superdrive -- Mac OS X Leopard 10.5.2<br>MacBook -- 13.3 inch -- Core 2, 1.83 GHz -- 1.5 GB RAM -- Combodrive -- Mac OS X Leopard 10.5.2<br>
iMac G5 -- 17 inch -- PPC G5 1.8 GHz -- 1 GB RAM -- Superdrive -- Mac OS X Leopard 10.5.2<br>iPod touch -- 16 GB -- Software Upgrade -- iPhone OS 1.1.4