I am a total beginner with some questions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

I am a total beginner with some questions

kennellgr
I really like programming (I've done some in C) and I decided I wanted to try doing some programming on my Mac. I spent hours online trying to find something that I could learn and settled on Squeak. I have it and barely understand the basics of it.

A few Questions:

1. What do I do to test whether or not a key has been pressed (in a method I want it to say 'if C key is pressed down do this')

2. What do I do to display a picture that I have on my computer?
Reply | Threaded
Open this post in threaded view
|

Re: I am a total beginner with some questions

Edgar J. De Cleene



El 4/7/08 6:44 PM, "kennellgr" <[hidden email]> escribió:

> I really like programming (I've done some in C) and I decided I wanted to try
> doing some programming on my Mac. I spent hours online trying to find
> something that I could learn and settled on Squeak. I have it and barely
> understand the basics of it.
>
> A few Questions:
>
> 1. What do I do to test whether or not a key has been pressed (in a method I
> want it to say 'if C key is pressed down do this')
>
> 2. What do I do to display a picture that I have on my computer?

Go for
http://ftp.squeak.org/various_images/FunSqueak/FunSqueak3.10alpha.6.zip
Into this you found the excellent "ProgrammingMorphs" tutorial by LexSpoon.

The short answer is you must look by handleKeystroke: message and similars
sended to Morph and inherited classes..

Any Squeak could load .png,.jpg,.gif.
Via drag and drop for 3.8 and newer and via fileList window for all.

Edgar


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: I am a total beginner with some questions

Marcus Strehlow
In reply to this post by kennellgr
Hi there,

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.

x := Sensor keyboardPeek asciiValue.
(x == 99) "99 is the ascii value for the letter c"
ifTrue: [Transcript show: 'letter c was pressed'; cr].

If this is implemented in the keyDown: method, everytime the c key is pressed, the Transcript should show the text specified.

You can find the ASCII values for each key on www.asciitable.com . In the image on the page, the ASCII value is the one in the Dec column.

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:

x := ImageMorph new.
x image: (Form fromFileNamed: 'path/to/your/image.jpg').
x openInWorld.

This will load the specified file, create the necessary form, and is then opened in your current world.

I hope this helps a bit,

Marcus



> Message: 1
> Date: Mon, 7 Apr 2008 14:44:32 -0700 (PDT)
> From: kennellgr <[hidden email]>
> Subject: [Newbies] I am a total beginner with some questions
> To: [hidden email]
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset=us-ascii


> I really like programming (I've done some in C) and I decided I wanted to try
> doing some programming on my Mac. I spent hours online trying to find
> something that I could learn and settled on Squeak. I have it and barely
> understand the basics of it.

> A few Questions:

> 1. What do I do to test whether or not a key has been pressed (in a method I
> want it to say 'if C key is pressed down do this')

> 2. What do I do to display a picture that I have on my computer?

--
iMac -- 20 inch -- Core 2, 2 GHz -- 1 GB RAM -- Superdrive -- Mac OS X Leopard 10.5.2
MacBook -- 13.3 inch -- Core 2, 1.83 GHz -- 1.5 GB RAM -- Combodrive -- Mac OS X Leopard 10.5.2
iMac G5 -- 17 inch -- PPC G5 1.8 GHz -- 1 GB RAM -- Superdrive -- Mac OS X Leopard 10.5.2
iPod touch -- 16 GB -- Software Upgrade -- iPhone OS 1.1.4
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: I am a total beginner with some questions

Tapple Gao
On Tue, Apr 08, 2008 at 04:53:12PM +0100, Marcus Strehlow wrote:
>    x := ImageMorph new.
>    x image: (Form fromFileNamed: 'path/to/your/image.jpg').
>    x openInWorld.

Even shorter:

x:= (Form fromFileNamed: 'path/to/your/image.jpg') asMorph.
x openInWorld.

>    This will load the specified file, create the necessary form, and is then
>    opened in your current world.

--
Matthew Fulmer -- http://mtfulmer.wordpress.com/
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: I am a total beginner with some questions

Stan Shepherd
In reply to this post by kennellgr
Hi, there is a nice small example, made by Bert, that you can import here:

http://www.nabble.com/Re%3A-Detecting-keyboard-state---finding-older-fixes-p15836979.html

...Stan


kennellgr wrote
1. What do I do to test whether or not a key has been pressed (in a method I want it to say 'if C key is pressed down do this')
Reply | Threaded
Open this post in threaded view
|

Re: I am a total beginner with some questions

kennellgr
In reply to this post by Marcus Strehlow
Hi,

I appreciate the help. I tried it out and it works. I have one problem though. I created a method called "gdkDKeyDown" (gdk is my innitials so I put it before my methods) and when I type gdkDKeyDown in a workspace and print it it says nil (it's supposed to say true or false) how do I make it return a value?

This is the method:


gdkDKeyDown
        | x |
        x := Sensor keyboardPeek asciiValue.
        x == 99
                ifTrue: [^ true].
        ^ false


Marcus Strehlow wrote
Hi there,

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.

x := Sensor keyboardPeek asciiValue.
(x == 99) "99 is the ascii value for the letter c"
ifTrue: [Transcript show: 'letter c was pressed'; cr].

If this is implemented in the keyDown: method, everytime the c key is
pressed, the Transcript should show the text specified.

You can find the ASCII values for each key on www.asciitable.com . In the
image on the page, the ASCII value is the one in the Dec column.

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:

x := ImageMorph new.
x image: (Form fromFileNamed: 'path/to/your/image.jpg').
x openInWorld.

This will load the specified file, create the necessary form, and is then
opened in your current world.

I hope this helps a bit,

Marcus



> Message: 1
> Date: Mon, 7 Apr 2008 14:44:32 -0700 (PDT)
> From: kennellgr <cboneg5@gmail.com>
> Subject: [Newbies] I am a total beginner with some questions
> To: beginners@lists.squeakfoundation.org
> Message-ID: <16540965.post@talk.nabble.com>
> Content-Type: text/plain; charset=us-ascii


> I really like programming (I've done some in C) and I decided I wanted to
try
> doing some programming on my Mac. I spent hours online trying to find
> something that I could learn and settled on Squeak. I have it and barely
> understand the basics of it.

> A few Questions:

> 1. What do I do to test whether or not a key has been pressed (in a method
I
> want it to say 'if C key is pressed down do this')

> 2. What do I do to display a picture that I have on my computer?

--
iMac -- 20 inch -- Core 2, 2 GHz -- 1 GB RAM -- Superdrive -- Mac OS X
Leopard 10.5.2
MacBook -- 13.3 inch -- Core 2, 1.83 GHz -- 1.5 GB RAM -- Combodrive -- Mac
OS X Leopard 10.5.2
iMac G5 -- 17 inch -- PPC G5 1.8 GHz -- 1 GB RAM -- Superdrive -- Mac OS X
Leopard 10.5.2
iPod touch -- 16 GB -- Software Upgrade -- iPhone OS 1.1.4

_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: I am a total beginner with some questions

Michael Haupt-3
Hi,

I wonder why no one has recommended the excellent "Squeak by Example"
book yet... to get a hang of what programming in Squeak looks (and
feels) like, you *really* ought to work your way through this book.
It's available as a free PDF download: http://www.squeakbyexample.org/

Now, on to your problem...

On Wed, Apr 9, 2008 at 2:38 AM, kennellgr <[hidden email]> wrote:
>  I appreciate the help. I tried it out and it works. I have one problem
>  though. I created a method called "gdkDKeyDown" (gdk is my innitials so I
>  put it before my methods) and when I type gdkDKeyDown in a workspace and
>  print it it says nil (it's supposed to say true or false) how do I make it
>  return a value?

In Smalltalk (and hence, also in Squeak), you cannot simply invoke a
method by typing its name and issuing "do it" or "print it" - instead,
you send a message to an object. To be able to do that, you need to
implement the method in some class so that instances of that class can
actually understand the message (and effectively execute the method).

Please look at "Squeak by Example"; I really feel you need to do that
before you start. :-)

>  This is the method:
>
>  gdkDKeyDown
>         | x |
>
>         x := Sensor keyboardPeek asciiValue.
>         x == 99
>                 ifTrue: [^ true].
>         ^ false

May I be so bold and suggest a few improvements? ;-) (Please don't
misunderstand me as patronising; I just want to point out some of the
beauties possible in Smalltalk, or programming in general.)

First of all, expressions like "x == 99 ifTrue: [ ^true ]" smell bad
in almost every programming language. You can as well (and much more
concisely) write "^x=99" - and you don't even need the "^false" any
more!

Why is that? - The expression "x=99" (you don't need to use == here; =
is commonly used for equality checks) evaluates to a Boolean value -
either true or false, so you can as well just return that.

Also, you don't really need the temporary variable "x" as you only
ever store once into it and then read it again.

In summary, your method could as well be as short as this:

gdkDKeyDown
    ^Sensor keyboardPeek asciiValue = 99

Nice, eh? And we haven't even started to abstract away from the D yet. ;-)

Best,

Michael
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: I am a total beginner with some questions

Nicolas Cellier-3
Michael Haupt wrote:

> Hi,
>
> I wonder why no one has recommended the excellent "Squeak by Example"
> book yet... to get a hang of what programming in Squeak looks (and
> feels) like, you *really* ought to work your way through this book.
> It's available as a free PDF download: http://www.squeakbyexample.org/
>
> Now, on to your problem...
>
> On Wed, Apr 9, 2008 at 2:38 AM, kennellgr <[hidden email]> wrote:
>>  I appreciate the help. I tried it out and it works. I have one problem
>>  though. I created a method called "gdkDKeyDown" (gdk is my innitials so I
>>  put it before my methods) and when I type gdkDKeyDown in a workspace and
>>  print it it says nil (it's supposed to say true or false) how do I make it
>>  return a value?
>
> In Smalltalk (and hence, also in Squeak), you cannot simply invoke a
> method by typing its name and issuing "do it" or "print it" - instead,
> you send a message to an object. To be able to do that, you need to
> implement the method in some class so that instances of that class can
> actually understand the message (and effectively execute the method).
>

A little bit more explanations: Why this nil?

If you take a look further at a formal description of Smalltalk syntax,
you will see that this sentence:
        gdkDKeyDown.
can only be interpreted as a variable, and in this case an undeclared
variable (from the workspace, only global variables from the Smalltalk
SystemDictionary are visible, also as variables attached to the
workspace as explained below).

When you evaluate ("doIt") from a workspace, then such undeclared
variables are automatically declared as workspace variables.

And since no value has ever been assigned to this workspace variable, it
is initialized with an instance of UndefinedObject, that is nil (the
sole instance of UndefinedObject in fact).

When you think of it, the meaning is simply undefined, something like
the NULL pointer in other languages... except that in Smalltalk this is
just an object among other objects. Yes as if you could operate on the
NULL pointer without crashing the application with a segmentation fault.
Isn't it a nice property?

You now need to find to which object you should send the gdkDKeyDown
message...

> Please look at "Squeak by Example"; I really feel you need to do that
> before you start. :-)
>

I strongly second Michael advice.

Cheers

Nicolas

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: I am a total beginner with some questions

kennellgr
In reply to this post by Michael Haupt-3
Michael,

I see what you mean about simplifying it - I'll do that. You said that this method is a message and needs to be sent to an object - which I understand - but now my question is which object? what object do I need to send gdkDKeyDown to in order for this to return true or false? By the way, I did read Squeak By Example.

Michael Haupt-3 wrote
In summary, your method could as well be as short as this:

gdkDKeyDown
    ^Sensor keyboardPeek asciiValue = 99

Nice, eh? And we haven't even started to abstract away from the D yet. ;-)

Best,

Michael
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: I am a total beginner with some questions

kennellgr
In reply to this post by Tapple Gao
I typed this into a workspace and it tells me that the image (I checked that the path is valid) does not exist. this is a screen shot of it:



do you have any idea why this error occurs?


matthewf wrote
On Tue, Apr 08, 2008 at 04:53:12PM +0100, Marcus Strehlow wrote:
>    x := ImageMorph new.
>    x image: (Form fromFileNamed: 'path/to/your/image.jpg').
>    x openInWorld.

Even shorter:

x:= (Form fromFileNamed: 'path/to/your/image.jpg') asMorph.
x openInWorld.

>    This will load the specified file, create the necessary form, and is then
>    opened in your current world.

--
Matthew Fulmer -- http://mtfulmer.wordpress.com/
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: I am a total beginner with some questions

Bert Freudenberg
Leave out the "MacPro HD1" part. The path should start with '/Users'.

You could open a File List, it shows the current path in its title.

- Bert -

On 15.04.2008, at 18:32, kennellgr wrote:

>
> I typed this into a workspace and it tells me that the image (I  
> checked that
> the path is valid) does not exist. this is a screen shot of it:
>
> http://www.nabble.com/file/p16714731/Squeak%2Berror%2B2.jpg
>
> do you have any idea why this error occurs?
>
>
>
> matthewf wrote:
>>
>> On Tue, Apr 08, 2008 at 04:53:12PM +0100, Marcus Strehlow wrote:
>>>   x := ImageMorph new.
>>>   x image: (Form fromFileNamed: 'path/to/your/image.jpg').
>>>   x openInWorld.
>>
>> Even shorter:
>>
>> x:= (Form fromFileNamed: 'path/to/your/image.jpg') asMorph.
>> x openInWorld.
>>
>>>   This will load the specified file, create the necessary form,  
>>> and is
>>> then
>>>   opened in your current world.
>>
>> --
>> Matthew Fulmer -- http://mtfulmer.wordpress.com/
>> _______________________________________________
>> Beginners mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
>>



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: I am a total beginner with some questions

Eric Eisaman
Hello Squeakers,
 
I have been quite persistant at learning Squeak Smalltalk over the past year however, I cannot percieve all that would need to be done to create a USB midi reader for external midi control.  Would someone be willing to embark on this task or at least outline a valid process by which I might be able to program such code?  I know this is tangential to this discussion on keyboard input and I'm sorry if this tangent contaminates this thread.
Eric Eisaman
Guam High School
On Thu, Apr 17, 2008 at 4:30 AM, Bert Freudenberg <[hidden email]> wrote:
Leave out the "MacPro HD1" part. The path should start with '/Users'.

You could open a File List, it shows the current path in its title.

- Bert -


On 15.04.2008, at 18:32, kennellgr wrote:

I typed this into a workspace and it tells me that the image (I checked that
the path is valid) does not exist. this is a screen shot of it:

http://www.nabble.com/file/p16714731/Squeak%2Berror%2B2.jpg

do you have any idea why this error occurs?



matthewf wrote:

On Tue, Apr 08, 2008 at 04:53:12PM +0100, Marcus Strehlow wrote:
 x := ImageMorph new.
 x image: (Form fromFileNamed: 'path/to/your/image.jpg').
 x openInWorld.

Even shorter:

x:= (Form fromFileNamed: 'path/to/your/image.jpg') asMorph.
x openInWorld.

 This will load the specified file, create the necessary form, and is
then
 opened in your current world.

--
Matthew Fulmer -- http://mtfulmer.wordpress.com/
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners





_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: I am a total beginner with some questions

kennellgr
In reply to this post by Bert Freudenberg
I used the string beginning with /Users and it still insists it doesn't exist.
This is the error:



<quote author="Bert Freudenberg">
Leave out the "MacPro HD1" part. The path should start with '/Users'.

You could open a File List, it shows the current path in its title.

- Bert -

On 15.04.2008, at 18:32, kennellgr wrote:
>
> I typed this into a workspace and it tells me that the image (I  
> checked that
> the path is valid) does not exist. this is a screen shot of it:
>
> http://www.nabble.com/file/p16714731/Squeak%2Berror%2B2.jpg
>
> do you have any idea why this error occurs?
>
>
>
> matthewf wrote:
>>
>> On Tue, Apr 08, 2008 at 04:53:12PM +0100, Marcus Strehlow wrote:
>>>   x := ImageMorph new.
>>>   x image: (Form fromFileNamed: 'path/to/your/image.jpg').
>>>   x openInWorld.
Reply | Threaded
Open this post in threaded view
|

Re: I am a total beginner with some questions

kennellgr
In reply to this post by kennellgr
I typed in the code for the key press and printed it and recieved an error. this is a screen shot of this:



A second question. How do I make a method to continuously check for this key press. If I have a morph class how do I create a method within it that says "while this morph exists check for this key being pressed and do something if it is pressed"?

kennellgr wrote
Hi,

I appreciate the help. I tried it out and it works. I have one problem though. I created a method called "gdkDKeyDown" (gdk is my innitials so I put it before my methods) and when I type gdkDKeyDown in a workspace and print it it says nil (it's supposed to say true or false) how do I make it return a value?

This is the method:


gdkDKeyDown
        | x |
        x := Sensor keyboardPeek asciiValue.
        x == 99
                ifTrue: [^ true].
        ^ false


Marcus Strehlow wrote
Hi there,

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.

x := Sensor keyboardPeek asciiValue.
(x == 99) "99 is the ascii value for the letter c"
ifTrue: [Transcript show: 'letter c was pressed'; cr].

If this is implemented in the keyDown: method, everytime the c key is
pressed, the Transcript should show the text specified.

You can find the ASCII values for each key on www.asciitable.com . In the
image on the page, the ASCII value is the one in the Dec column.

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:

x := ImageMorph new.
x image: (Form fromFileNamed: 'path/to/your/image.jpg').
x openInWorld.

This will load the specified file, create the necessary form, and is then
opened in your current world.

I hope this helps a bit,

Marcus



> Message: 1
> Date: Mon, 7 Apr 2008 14:44:32 -0700 (PDT)
> From: kennellgr <cboneg5@gmail.com>
> Subject: [Newbies] I am a total beginner with some questions
> To: beginners@lists.squeakfoundation.org
> Message-ID: <16540965.post@talk.nabble.com>
> Content-Type: text/plain; charset=us-ascii


> I really like programming (I've done some in C) and I decided I wanted to
try
> doing some programming on my Mac. I spent hours online trying to find
> something that I could learn and settled on Squeak. I have it and barely
> understand the basics of it.

> A few Questions:

> 1. What do I do to test whether or not a key has been pressed (in a method
I
> want it to say 'if C key is pressed down do this')

> 2. What do I do to display a picture that I have on my computer?

--
iMac -- 20 inch -- Core 2, 2 GHz -- 1 GB RAM -- Superdrive -- Mac OS X
Leopard 10.5.2
MacBook -- 13.3 inch -- Core 2, 1.83 GHz -- 1.5 GB RAM -- Combodrive -- Mac
OS X Leopard 10.5.2
iMac G5 -- 17 inch -- PPC G5 1.8 GHz -- 1 GB RAM -- Superdrive -- Mac OS X
Leopard 10.5.2
iPod touch -- 16 GB -- Software Upgrade -- iPhone OS 1.1.4

_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: I am a total beginner with some questions

Michael Haupt-3
In reply to this post by kennellgr
Hi,

On Wed, Apr 16, 2008 at 12:29 AM, kennellgr <[hidden email]> wrote:
>  I see what you mean about simplifying it - I'll do that. You said that this
>  method is a message and needs to be sent to an object - which I understand -
>  but now my question is which object? what object do I need to send
>  gdkDKeyDown to in order for this to return true or false?

the method should be an (instance or class) method of some class. You
should create an instance of that class, and send the message to that
instance.

> By the way, I did read Squeak By Example.

Then you should know how to create classes, add methods to, and
instantiate them.

Best,

Michael
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: I am a total beginner with some questions

Bert Freudenberg
In reply to this post by kennellgr
kennellgr (*),

you are dealing with a computer, who is by far not as tolerant as a  
human. You have to be precise. When I wrote "The path should start  
with '/Users'" I literally meant that. The first character in the path  
has to be a slash ('/'). I guess Marcus guessed that you had dealt  
with computers before so his example was a tiny bit vague.

Also, as I wrote, please (!) open a File List. Click on the Squeak  
window background, choose "open...", then "file list". Look at the  
title bar of the file list window *carefully*. The path displayed  
there should start with a slash character, too.

Incidentally, you can use the file list to open your picture file,  
too. Navigate to the right folder and press the "open" button. Or, you  
could have dropped the jpg file from the finder into Squeak. This uses  
the full path to the file internally, which is much easier and less  
prone to errors than having to type it manually. If you need the path  
in your code, select to the file in the file list, and choose "copy  
name to clipboard" from the context menu (alt-click or ctrl-click).  
Then paste it to the workspace.

On a final note, when you open a file list, it will show Squeak's  
"default directory". In this directory it places a file called  
"SqueakDebug.log" whenever an error occurs. It's more useful to post  
that file than making a screenshot.

Have fun!

- Bert -

(*) We prefer real names in the Squeak community. Makes communication  
much nicer.

On 17.04.2008, at 01:02, kennellgr wrote:

>
> I used the string beginning with /Users and it still insists it  
> doesn't
> exist.
> This is the error:
>
> http://www.nabble.com/file/p16735495/Squeak%2Berror%2B3.jpg
>
>>
>> Leave out the "MacPro HD1" part. The path should start with '/Users'.
>>
>> You could open a File List, it shows the current path in its title.
>>
>> - Bert -
>>
>> On 15.04.2008, at 18:32, kennellgr wrote:
>>>
>>> I typed this into a workspace and it tells me that the image (I
>>> checked that
>>> the path is valid) does not exist. this is a screen shot of it:
>>>
>>> http://www.nabble.com/file/p16714731/Squeak%2Berror%2B2.jpg
>>>
>>> do you have any idea why this error occurs?
>>>
>>>
>>>
>>> matthewf wrote:
>>>>
>>>> On Tue, Apr 08, 2008 at 04:53:12PM +0100, Marcus Strehlow wrote:
>>>>>  x := ImageMorph new.
>>>>>  x image: (Form fromFileNamed: 'path/to/your/image.jpg').
>>>>>  x openInWorld.
>
>
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: I am a total beginner with some questions

Karl-19
Bert Freudenberg wrote:

> kennellgr (*),
>
> you are dealing with a computer, who is by far not as tolerant as a
> human. You have to be precise. When I wrote "The path should start
> with '/Users'" I literally meant that. The first character in the path
> has to be a slash ('/'). I guess Marcus guessed that you had dealt
> with computers before so his example was a tiny bit vague.
>
> Also, as I wrote, please (!) open a File List. Click on the Squeak
> window background, choose "open...", then "file list". Look at the
> title bar of the file list window *carefully*. The path displayed
> there should start with a slash character, too.
You can also get the path from the the context menu in the right top
pane; select the file you want, right click and select copy name to
clipboard. You can now paste in the correct path.
Karl

>
> Incidentally, you can use the file list to open your picture file,
> too. Navigate to the right folder and press the "open" button. Or, you
> could have dropped the jpg file from the finder into Squeak. This uses
> the full path to the file internally, which is much easier and less
> prone to errors than having to type it manually. If you need the path
> in your code, select to the file in the file list, and choose "copy
> name to clipboard" from the context menu (alt-click or ctrl-click).
> Then paste it to the workspace.
>
> On a final note, when you open a file list, it will show Squeak's
> "default directory". In this directory it places a file called
> "SqueakDebug.log" whenever an error occurs. It's more useful to post
> that file than making a screenshot.
>
> Have fun!
>
> - Bert -
>
> (*) We prefer real names in the Squeak community. Makes communication
> much nicer.
>
> On 17.04.2008, at 01:02, kennellgr wrote:
>>
>> I used the string beginning with /Users and it still insists it doesn't
>> exist.
>> This is the error:
>>
>> http://www.nabble.com/file/p16735495/Squeak%2Berror%2B3.jpg
>>
>>>
>>> Leave out the "MacPro HD1" part. The path should start with '/Users'.
>>>
>>> You could open a File List, it shows the current path in its title.
>>>
>>> - Bert -
>>>
>>> On 15.04.2008, at 18:32, kennellgr wrote:
>>>>
>>>> I typed this into a workspace and it tells me that the image (I
>>>> checked that
>>>> the path is valid) does not exist. this is a screen shot of it:
>>>>
>>>> http://www.nabble.com/file/p16714731/Squeak%2Berror%2B2.jpg
>>>>
>>>> do you have any idea why this error occurs?
>>>>
>>>>
>>>>
>>>> matthewf wrote:
>>>>>
>>>>> On Tue, Apr 08, 2008 at 04:53:12PM +0100, Marcus Strehlow wrote:
>>>>>>  x := ImageMorph new.
>>>>>>  x image: (Form fromFileNamed: 'path/to/your/image.jpg').
>>>>>>  x openInWorld.
>>
>>
>>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: I am a total beginner with some questions

Bert Freudenberg

Am 17.04.2008 um 23:06 schrieb karl <[hidden email]>:

> Bert Freudenberg wrote:
>> kennellgr (*),
>>
>> you are dealing with a computer, who is by far not as tolerant as a  
>> human. You have to be precise. When I wrote "The path should start  
>> with '/Users'" I literally meant that. The first character in the  
>> path has to be a slash ('/'). I guess Marcus guessed that you had  
>> dealt with computers before so his example was a tiny bit vague.
>>
>> Also, as I wrote, please (!) open a File List. Click on the Squeak  
>> window background, choose "open...", then "file list". Look at the  
>> title bar of the file list window *carefully*. The path displayed  
>> there should start with a slash character, too.
> You can also get the path from the the context menu in the right top  
> pane; select the file you want, right click and select copy name to  
> clipboard. You can now paste in the correct path.
> Karl

You mean like I wrote in the next paragraph? ;)

- Bert -

>
>>
>> Incidentally, you can use the file list to open your picture file,  
>> too. Navigate to the right folder and press the "open" button. Or,  
>> you could have dropped the jpg file from the finder into Squeak.  
>> This uses the full path to the file internally, which is much  
>> easier and less prone to errors than having to type it manually. If  
>> you need the path in your code, select to the file in the file  
>> list, and choose "copy name to clipboard" from the context menu  
>> (alt-click or ctrl-click). Then paste it to the workspace.
>>
>> On a final note, when you open a file list, it will show Squeak's  
>> "default directory". In this directory it places a file called  
>> "SqueakDebug.log" whenever an error occurs. It's more useful to  
>> post that file than making a screenshot.
>>
>> Have fun!
>>
>> - Bert -
>>
>> (*) We prefer real names in the Squeak community. Makes  
>> communication much nicer.
>>
>> On 17.04.2008, at 01:02, kennellgr wrote:
>>>
>>> I used the string beginning with /Users and it still insists it  
>>> doesn't
>>> exist.
>>> This is the error:
>>>
>>> http://www.nabble.com/file/p16735495/Squeak%2Berror%2B3.jpg
>>>
>>>>
>>>> Leave out the "MacPro HD1" part. The path should start with '/
>>>> Users'.
>>>>
>>>> You could open a File List, it shows the current path in its title.
>>>>
>>>> - Bert -
>>>>
>>>> On 15.04.2008, at 18:32, kennellgr wrote:
>>>>>
>>>>> I typed this into a workspace and it tells me that the image (I
>>>>> checked that
>>>>> the path is valid) does not exist. this is a screen shot of it:
>>>>>
>>>>> http://www.nabble.com/file/p16714731/Squeak%2Berror%2B2.jpg
>>>>>
>>>>> do you have any idea why this error occurs?
>>>>>
>>>>>
>>>>>
>>>>> matthewf wrote:
>>>>>>
>>>>>> On Tue, Apr 08, 2008 at 04:53:12PM +0100, Marcus Strehlow wrote:
>>>>>>> x := ImageMorph new.
>>>>>>> x image: (Form fromFileNamed: 'path/to/your/image.jpg').
>>>>>>> x openInWorld.
>>>
>>>
>>>
>> _______________________________________________
>> Beginners mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: I am a total beginner with some questions

Karl-19
Bert Freudenberg wrote:

>
> Am 17.04.2008 um 23:06 schrieb karl <[hidden email]>:
>
>> Bert Freudenberg wrote:
>>> kennellgr (*),
>>>
>>> you are dealing with a computer, who is by far not as tolerant as a
>>> human. You have to be precise. When I wrote "The path should start
>>> with '/Users'" I literally meant that. The first character in the
>>> path has to be a slash ('/'). I guess Marcus guessed that you had
>>> dealt with computers before so his example was a tiny bit vague.
>>>
>>> Also, as I wrote, please (!) open a File List. Click on the Squeak
>>> window background, choose "open...", then "file list". Look at the
>>> title bar of the file list window *carefully*. The path displayed
>>> there should start with a slash character, too.
>> You can also get the path from the the context menu in the right top
>> pane; select the file you want, right click and select copy name to
>> clipboard. You can now paste in the correct path.
>> Karl
>
> You mean like I wrote in the next paragraph? ;)
>
> - Bert -

Yes :-)

Karl

>
>>
>>>
>>> Incidentally, you can use the file list to open your picture file,
>>> too. Navigate to the right folder and press the "open" button. Or,
>>> you could have dropped the jpg file from the finder into Squeak.
>>> This uses the full path to the file internally, which is much easier
>>> and less prone to errors than having to type it manually. If you
>>> need the path in your code, select to the file in the file list, and
>>> choose "copy name to clipboard" from the context menu (alt-click or
>>> ctrl-click). Then paste it to the workspace.
>>>
>>> On a final note, when you open a file list, it will show Squeak's
>>> "default directory". In this directory it places a file called
>>> "SqueakDebug.log" whenever an error occurs. It's more useful to post
>>> that file than making a screenshot.
>>>
>>> Have fun!
>>>
>>> - Bert -
>>>
>>> (*) We prefer real names in the Squeak community. Makes
>>> communication much nicer.
>>>
>>> On 17.04.2008, at 01:02, kennellgr wrote:
>>>>
>>>> I used the string beginning with /Users and it still insists it
>>>> doesn't
>>>> exist.
>>>> This is the error:
>>>>
>>>> http://www.nabble.com/file/p16735495/Squeak%2Berror%2B3.jpg
>>>>
>>>>>
>>>>> Leave out the "MacPro HD1" part. The path should start with '/Users'.
>>>>>
>>>>> You could open a File List, it shows the current path in its title.
>>>>>
>>>>> - Bert -
>>>>>
>>>>> On 15.04.2008, at 18:32, kennellgr wrote:
>>>>>>
>>>>>> I typed this into a workspace and it tells me that the image (I
>>>>>> checked that
>>>>>> the path is valid) does not exist. this is a screen shot of it:
>>>>>>
>>>>>> http://www.nabble.com/file/p16714731/Squeak%2Berror%2B2.jpg
>>>>>>
>>>>>> do you have any idea why this error occurs?
>>>>>>
>>>>>>
>>>>>>
>>>>>> matthewf wrote:
>>>>>>>
>>>>>>> On Tue, Apr 08, 2008 at 04:53:12PM +0100, Marcus Strehlow wrote:
>>>>>>>> x := ImageMorph new.
>>>>>>>> x image: (Form fromFileNamed: 'path/to/your/image.jpg').
>>>>>>>> x openInWorld.
>>>>
>>>>
>>>>
>>> _______________________________________________
>>> Beginners mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>>
>>
>> _______________________________________________
>> Beginners mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners