Ok.. I'm toying around with VW and am working on some rudimentary objects
to get my feet wet with Smalltalk and ran into a problem that I can't figure out.. I managed to create a class just fine in my own test package. I then managed to setup my "accessing" protocol (protocol seems like a strange term for this, but I guess if categories is already used, perhaps it's OK) for all of my classes instance variables. I then found a nice menu option that created all of my accessors for me -- Cool! Now, I want to add another accessor to the list in the far right pane of the browser but can't seem to find/figure out how to go about it.. I don't see any menu options under the "Methods" menu for "add" or similar.. I've got a class instance variable that's supposed to be a sort of boolean if you will (yeah, I know Smalltalk doesn't do types, but I do embedded C++ for my day job and it's stuck in my head!) and want a method called "MakeAcctLocked" and another called "MakeAcctUnlocked" that will flip-flop the same instance variable and aid in readability. Anyway, I'm sure I'm just missing something on how to do the adding of a new method -- can someone please point me in the right direction? Thanks much in advance! -- Rick |
Rick,
You might be stumbling over the mechanics of the editor/browser. No problem. Been there. To add a new method, simply start typing. If you have another method already selected, then highlight the entire context in the big editing pane and start typing. If you have no method selected, again, highlight the text that appears in the big editing pand and start typing. When you accept your text, it will create a new method entry in the upper, right pane. Its magic. Hope that was what you wanted... Charlie ----- Original Message ----- From: "Rick F." <[hidden email]> To: <[hidden email]> Sent: Wednesday, January 25, 2006 2:40 PM Subject: Stuck -- newbie question : How to add new instance method? > Ok.. I'm toying around with VW and am working on some rudimentary objects > to get my feet wet with Smalltalk and ran into a problem that I can't > figure out.. I managed to create a class just fine in my own test > package. > I then managed to setup my "accessing" protocol (protocol seems like a > strange > term for this, but I guess if categories is already used, perhaps it's OK) > for all of my classes instance variables. I then found a nice menu option > that created all of my accessors for me -- Cool! > > Now, I want to add another accessor to the list in the far right pane of > the browser but can't seem to find/figure out how to go about it.. I don't > see any menu options under the "Methods" menu for "add" or similar.. > > I've got a class instance variable that's supposed to be a sort of boolean > if you will (yeah, I know Smalltalk doesn't do types, but I do embedded > C++ > for my day job and it's stuck in my head!) and want a method called > "MakeAcctLocked" and another called "MakeAcctUnlocked" that will flip-flop > the same instance variable and aid in readability. Anyway, I'm sure I'm > just missing something on how to do the adding of a new method -- can > someone please point me in the right direction? > > Thanks much in advance! > > -- Rick > > |
In reply to this post by Rick Flower
On 1/25/06, Rick F. <[hidden email]> wrote:
> I've got a class instance variable that's supposed to be a sort of boolean > if you will (yeah, I know Smalltalk doesn't do types, but I do embedded C++ > for my day job and it's stuck in my head!) and want a method called > "MakeAcctLocked" and another called "MakeAcctUnlocked" that will flip-flop > the same instance variable and aid in readability. Anyway, I'm sure I'm > just missing something on how to do the adding of a new method -- can > someone please point me in the right direction? Rick, While I think maybe a menu option to do that would be cool... a couple things: 1) You can do it by selecting the protocol, and then just replacing the text and saving it in the bottom pane of the browser. It's really that simple. For example: lock self immutable: true. and then: unlock self immutable: false. 2) Traditionally we use (we = Smalltalkers) shorter names and initial lower-case. Also, they tend to be verbish, if that makes sense. Chris -- | Christopher Petrilli | [hidden email] |
In reply to this post by Rick Flower
-covering message-
+----------------------------- | Date: Wed, 25 Jan 2006 12:40:58 -0800 | From: "Rick F." <[hidden email]> | Subject: Stuck -- newbie question : How to add new instance method? | Ok.. I'm toying around with VW and am working on some rudimentary objects | to get my feet wet with Smalltalk and ran into a problem that I can't | figure out.. I managed to create a class just fine in my own test package. | I then managed to setup my "accessing" protocol (protocol seems like a strange | term for this, but I guess if categories is already used, perhaps it's OK) | for all of my classes instance variables. I then found a nice menu option | that created all of my accessors for me -- Cool! | Now, I want to add another accessor to the list in the far right pane of | the browser but can't seem to find/figure out how to go about it.. I don't | see any menu options under the "Methods" menu for "add" or similar.. | I've got a class instance variable that's supposed to be a sort of boolean | if you will (yeah, I know Smalltalk doesn't do types, but I do embedded C++ | for my day job and it's stuck in my head!) and want a method called | "MakeAcctLocked" and another called "MakeAcctUnlocked" that will flip-flop | the same instance variable and aid in readability. Anyway, I'm sure I'm | just missing something on how to do the adding of a new method -- can | someone please point me in the right direction? | Thanks much in advance! | -- Rick Select your accessing protocol. Type the following in the code view and then accept (ctrl-s): lockAccount locked := true |
In reply to this post by Christopher Petrilli
* Christopher Petrilli <[hidden email]> [2006-01-25 15:53:57 -0500]:
> 1) You can do it by selecting the protocol, and then just replacing > the text and saving it in the bottom pane of the browser. It's really > that simple. For example: > > lock > self immutable: true. > > and then: > > unlock > self immutable: false. Doh! I didn't even think about that.. Consider me flogged! I just tried it and it worked like a charm! I guess I'll have to go read up on what the above immutable does (no need to explain here, I'll go poke around in the online books) > 2) Traditionally we use (we = Smalltalkers) shorter names and initial > lower-case. Also, they tend to be verbish, if that makes sense. Cool.. I'm still trying to wrap my head around the dramatic changes this language has from what I'm used to doing! Thanks to all of you that replied in record time! -- Rick |
Free forum by Nabble | Edit this page |