[Newbies] smalltalk and squeak

Derek O'Connell doc at doconnel.f9.co.uk
Fri Nov 18 11:53:59 UTC 2011


On 18/11/11 08:59, dimitris chloupis wrote:
> I am also very interested in this question. I can create a morph with drag and drop and inspect it , but i cant change its variables in any way. Also the System / Class browser you mention is only for class definition , and not giving access to instance objects . For example an instance object will have its own size and of course its own location , how can I access these variables of that specific object ?

The "inspector" displays the instance vars. Just to be certain, if you 
have opened an actual inspector on a morph it will have three panes with 
a list of instance vars in the left one. Select any var and its value is 
displayed in the right pane. *With the mouse cursor over the right pane* 
the value can then be edited followed by "accepting" any changes using 
alt/ctrl-s or middle/right-click and selecting "accept" (the actual 
modifier key and/or mouse button used will depend on your prefs). The 
mouse cursor position is important to indicate where text will be 
entered and no changes are made until you "accept" them.

> Is there is way to edit a specific object, access its variables and functions

By "specific object" I think you mean "specific instance". You need to 
realize the distinction between Classes and Instances. What you refer to 
as "functions" is generally called "behaviour" implemented as "methods" 
in classes and viewed via a Browser. This behaviour is shared by all 
instances of a class while state specific to each instance ("instance 
variables") is stored by the instance itself and viewed in an inspector.

>   or even assign it to a variable by using only the IDE ?

I'm guessing your question is really this: if I have a morph on screen 
how can I manipulate it in a workspace? If so then click the menu button 
on a workspace (blue button, downward pointing triangle) and select 
"create textual references to dropped morphs". Then simply drag&drop a 
morph over the workspace and a variable will be defined for it.

Btw, my guesswork above doesn't imply anything about you, it comes from 
my own experience learning Squeak/Smalltalk where a certain degree of 
familiarity is needed before I even understood what I was trying to ask. 
Bit of a chicken&egg situation to begin with but the penny drops eventually.

Casey recommended a good book but I would suggest starting with 
Squeak-by-Example to begin with:

http://www.squeakbyexample.org/

Also, most questions already have an answer either via the documentation 
page on Squeak.org or by searching the swiki...

http://www.squeak.org/Documentation/
http://wiki.squeak.org/


>
>
>
> ________________________________
>   From: James O'Brien<obrienjs at comcast.net>
> To: A friendly place to get answers to even the most basic questions about Squeak.<beginners at lists.squeakfoundation.org>
> Sent: Friday, 18 November 2011, 9:16
> Subject: Re: [Newbies] smalltalk and squeak
>
>
> Thank you for your suggestions.
>
>
> I guess I'm thinking in terms of HyperCard. With HyperCard I
>        could script a button, field, card, stack, etc. With Squeak, I
>        can't figure out
>        to change what the calculator’s buttons do. If had created the
>        calculator with
>        HyperCard, I could easily change how its buttons work. Just open
>        them and there's
>        the script.
>
> I’ve tried using the Browser, but can't access the Smalltalk code for the calculator, whether I create it with Smalltalk in the Workspace or build it using Morphic. Still don't get it.
>
> On 11/17/11 9:47 PM, Casey Ransberger wrote:
> Squeak is the original Smalltalk system. It was rebranded at Apple, because no one there wanted to hear anything else about Smalltalk.
>>
>> I wonder: are you wondering what the difference between the environment and the language is?
>>
>>
>> The environment is implemented by the language.
>>
>>
>> The best single text is the "Blue Book" which is called Smalltalk: the Language and its Environment.
>>
>>
>> That the language implements the environment is insanely powerful. This will eventually start to make sense if you stick with it.
>>
>>
>> You should look for the Class Browser.  One way to reach it is to highlight a class name (try Object) and do either command-b or control-b (on Windows, possibly Linux too, but I don't use these so it might be alt, not control.)
>>
>>
>> You put your code into the browser when you want to keep it. Smalltalk is a kind of object database. Your code lives in this object database.
>>
>>
>> If this doesn't answer your question, feel free to reframe it, but look for that browser.
>>
>>
>> Hope this helps!
>>
>>
>> Casey
>>
>> On Nov 17, 2011, at 9:25 PM, James O'Brien<obrienjs at comcast.net>  wrote:
>>
>>
>> I don't get the connection between smalltalk and squeak. For example, I can code a counter with smalltalk in the workspace. When I do it a functioning counter appears. When I close the workspace the calculator still works, but what happens to the code? Where is it? If I open a viewer of one of the buttons and change the button's color, what happens to the code I started with? Where is it? How do I view it again?
>>>
>>> I can also build a calculator with squeak as described at http://wiki.squeak.org/squeak/1827. But, again, where is the smalltalk code?
>> _______________________________________________
>>> Beginners mailing list
>>> Beginners at lists.squeakfoundation.org
>>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>>
>>
>> _______________________________________________
> Beginners mailing list Beginners at lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
> This body part will be downloaded on demand.



More information about the Beginners mailing list