[Newbies] perform withArguments
Lou at Keystone-Software.com
Mon Apr 23 17:44:22 UTC 2012
For your example:
cellObject cellLock: aBoolean
where cellObject is to look like: cell1, cell2, cell3 ..., or cell9
I don't think you want or need to use #perform:. You use #perform: when
you want to construct the message name and sent the constructed message
name to an object.
In your case you know the message you want to send, it is #cellLock:. What
you don't know (or have easily available) is the object you want to send
the message to.
What I think you need to do is save your cell objects in an array or
collection (I will let you look up collections, but ask again if you need
help). With something like:
cellObjects := OrderedCollection new.
cellObjects add: YourCellClass new.
Once you have a collection of your cells, you can access one or more of
them and sent the #cellLock: message to it like so:
(cellObjects at: cellNumber) cellLock: aBoolean
Good luck and keep posting if you need help.
On Mon, 23 Apr 2012 07:58:47 -0700 (PDT), OrgmiGeek
<cool.origami.1 at gmail.com> wrote:
>I've read the sparse documentation on 'dynamic message' calls and I've
>experimented a lot and still cannot figure out how to do something that
>should be simple:
>I want to build a message like this:
> cellObject cellLock: aBoolean
>where cellObject is to look like: cell1, cell2, cell3 ..., or cell9
>I can build up cellObject like this:
> self perform: ('cell', cellNumber asString) asSymbol
>but I can't figure out how to build the full message with the key selector
>"cellLock:", and the value 'aBoolean'.
>I've tried everything I can think of based on the terse documentation, and
>anything I can find on the internet, which isn't much (including this
>Any help would be appreciated.
>Under the age of 15 so don't want to post my name :D
Keystone Software Corp.
mailto:Lou at Keystone-Software.com http://www.Keystone-Software.com
More information about the Beginners