squeak

How to insert an image into a PolygonMorph?

I need to get a texture into a PolygonMorph, but these seem to require an InfiniteForm as color/ filling. The InfiniteForm is no solution as i need to rotate the PolygonMorph later on and moving the PolygonMorph around also has sideeffects on the displayed texture. It would be very useful if it would be possible to scale the inserted ...

How to automate unit testing in Squeak

I am checking Squeak homework assignments submitted by my students. I have written an SUnit test case with a bunch of tests and now I want to run these on all submissions. I would like to somehow automate - whether from inside Squeak or with shell scripts - the process of loading a student submission, running the test case on it, and sa...

How to use the mousewheel in a Squeak / Morphic GUI

I am implementing a graphical user interface with Morphic / Squeak. Some of the items have drag & drop functionality. While dragging, I want to be able to rotate these items with the mousewheel. The first problem is that using the mousewheel ends the drag-action and leads to a drop (attempt). How can I suppress that - and fire the mouse...

Event propagation in a Morphic GUI

I have an image for a Squeak Morphic GUI that contains some transparent parts and thus should not accept any mouseevents etc. but just be visible, but it needs to be visible in front of other morphs. That's why i thought it would be useful to propagate the appearing mouseevents to the underlying morphs. Does anyone know a solution for...

Working with Excel files in web app frameworks like Seaside

Ive been reading about seaside and like the sound of it but i cant see an easy way for handling data files, primarily importing Excel. Of course csv files would be more straight forward, but are there any ways to import the various Excel formats (xls,xlsx) without writing your own file parsing routines? I've heard that the need to open...

What is the difference between a Squeak/Pharo Trait and a Newspeak Mixin?

So Squeak/Pharo support Traits and Newspeak has Mixins. What is the difference? Traits have no instVars but Mixins have? ...

What is the "best practice" portable way of Symbol using in Smalltalk?

What are the "best practice" rules for using symbols in Smalltalk in a portable way? I use squeak and pharo mainly and I know they both allow 'foo' = #foo and #foo = 'foo' to be true while other Smalltalks don't. I understand Symbols are for identification and shouldn't be used in place of strings. But is it at least safe to assume that ...

Squeak - SUnit Testing for Errors

I have been suggested to use should:rise in my test case to test for errors that a method might raise. For some reason it does not work as expected, so I want to verify that I'm doing it right. Here is the code in the test case: self should: [aMyClass compareTo: 'This is a string'] raise: 'invalid input'. My compareTo/1 method looks l...

Could SqueakNOS or PharoNOS made to run an iPhone or iPad to Form a DynaBook?

Not considering legal issues I would be very interested if it would be possible to run one of those on the bare metal of the iPad/Phone ARM-Architecture. ...

How do I get the name of the current method in squeak?

Hi! As stated above - I need to find the current method's name in runtime. how do I do this? ...

How do I get the value of a class variable in squeak?

Hi, I have a string that contains the name of a class variable that I know exists for class A. I need to get the value of this variable (i.e. dereferencing), how do I do it? ...

How do I compare between ByteString and ByteSymbol in squeak?

Hi, I want to execute the following code: methodName := thisContext sender method selector. aClass selectors do: [:current | current == methodName ifTrue: aBlock]. Although the strings are equal, it never steps into the "ifTrue", I've tried converting both of them to ByteArray\String and it steel didn't work. Any ideas of how to comp...

How to Retrieve Method's Signature in Squeak

printThisMethodSig: aSomething stack := thisContext stackOfSize: 2. Transcript show: (stack at: 2); cr. stack at: 2 returns the method context of the current method. It is possible to retrieve the compiled method of the current method using method message. I want to be able to print the whole signature of the method, for example: from:...

Create New Pseudo Variables in Squeak

Large part of squeak is implemented using squeak itself. I am curious to know if pseudo variables such as self or true are also implemented using squeak. If the answer is yes, where the implementation located? Specifically, assume that I want to add new subclass of "Boolean" called "Other" which will represent a third option: neither tr...

Is Pharo just a repackaging/rebranding of Squeak?

I'm trying to learn some Smalltalk. First found was Squeak, but since it has been removed from Gentoo ebuild tree because of security problem, so I decided to find an alternative. Then I found Pharo through Seaside project, after I downloaded Pharo 1.0 package, there are actually a SqueakVM inside! So, my question is: Is Pharo just a r...

I need a dictionary-like mapping between characters and other kinds of objects. Which class would be best?

This is in Squeak/Pharo. If I want to have a mapping between Character objects like $a and $b to other kinds of objects, and want to look up those other objects based on the Character, what is the best class to use? Dictionary is an obvious choice, but seems wasteful to be hashing character objects which are basically already numbers. I ...

How can I get all the methods in a Protocol?

Hello, How can I get a collection of all the (class) methods in a given protocol in smalltalk/squeak/pharo? I'm trying to collect the values returned by a group of methods. I don't want to have to store the methods in an instance or class variable. So I though I could add them to a protocol and in this way to "mark" them. Thanks. ...

Using Squeak from a shell

Can I launch Squeak as a REPL (no GUI), where I can enter and evaluate Smalltalk expressions? I know the default image don't allow this. Is there any documentation on how to build a minimum image that can be accessed from a command-line shell? ...

How to tell if a class uses a Trait

If I have a Trait that some classes use but not others, how can I test an object to see if it is an instance of a class that uses that Trait? What I want is something like isMemberOf: or isKindOf: but for Traits. ...

How to get the bytes that makeup an integer?

In Smalltalk (or at least Squeak and Pharo), is there a portable way to get the bytes that make up an integer, starting with the most significant byte followed by the next-most, and so on, regardless of byte-ordering differences across platforms? ...