I typed the following in a workspace and created a rectangle: FirstBox := RectangleMorph new openInWorld. I then changed its color: FirstBox color: Color green. I next created a system category with a RectangleMorph subclass: RectangleMorph subclass: #TestBox instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'SqueakExperiment' I then used a workspace to create a new rectangle: SecondBox := TestBox new openInWorld. But I could not change its color like I could with the first rectangle: SecondBox color: Color green. How can I change the second rectangle’s color by sending it a message from a workspace? _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Your boxes are piling up. Drag one off the other and you'll see that you did.
Chris On 2012-06-15, at 11:12 AM, James O'Brien wrote: > I typed the following in a workspace and created a rectangle: > FirstBox := RectangleMorph new openInWorld. > > I then changed its color: > FirstBox color: Color green. > > I next created a system category with a RectangleMorph subclass: > RectangleMorph subclass: #TestBox > instanceVariableNames: '' > classVariableNames: '' > poolDictionaries: '' > category: 'SqueakExperiment' > > I then used a workspace to create a new rectangle: > SecondBox := TestBox new openInWorld. > > But I could not change its color like I could with the first rectangle: > SecondBox color: Color green. > > How can I change the second rectangle’s color by sending it a message from a workspace? > > _______________________________________________ > Beginners mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/beginners _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
I had moved the first box out of the way. I should have mentioned that when I try to change the second box's color I get an error message: MessageNotUnderstood: SecondBox class >> #color:
On Jun 15, 2012, at 9:20 AM, Chris Cunnington wrote: > Your boxes are piling up. Drag one off the other and you'll see that you did. > > Chris > > On 2012-06-15, at 11:12 AM, James O'Brien wrote: > >> I typed the following in a workspace and created a rectangle: >> FirstBox := RectangleMorph new openInWorld. >> >> I then changed its color: >> FirstBox color: Color green. >> >> I next created a system category with a RectangleMorph subclass: >> RectangleMorph subclass: #TestBox >> instanceVariableNames: '' >> classVariableNames: '' >> poolDictionaries: '' >> category: 'SqueakExperiment' >> >> I then used a workspace to create a new rectangle: >> SecondBox := TestBox new openInWorld. >> >> But I could not change its color like I could with the first rectangle: >> SecondBox color: Color green. >> >> How can I change the second rectangle’s color by sending it a message from a workspace? >> >> _______________________________________________ >> 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 |
I think I figured out the problem. I named the box SecondBox instead of secondBox. Using secondBox works.
On Jun 15, 2012, at 10:43 AM, James O'Brien wrote: > I had moved the first box out of the way. I should have mentioned that when I try to change the second box's color I get an error message: MessageNotUnderstood: SecondBox class >> #color: > > On Jun 15, 2012, at 9:20 AM, Chris Cunnington wrote: > >> Your boxes are piling up. Drag one off the other and you'll see that you did. >> >> Chris >> >> On 2012-06-15, at 11:12 AM, James O'Brien wrote: >> >>> I typed the following in a workspace and created a rectangle: >>> FirstBox := RectangleMorph new openInWorld. >>> >>> I then changed its color: >>> FirstBox color: Color green. >>> >>> I next created a system category with a RectangleMorph subclass: >>> RectangleMorph subclass: #TestBox >>> instanceVariableNames: '' >>> classVariableNames: '' >>> poolDictionaries: '' >>> category: 'SqueakExperiment' >>> >>> I then used a workspace to create a new rectangle: >>> SecondBox := TestBox new openInWorld. >>> >>> But I could not change its color like I could with the first rectangle: >>> SecondBox color: Color green. >>> >>> How can I change the second rectangle’s color by sending it a message from a workspace? >>> >>> _______________________________________________ >>> 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 |
In reply to this post by James O'Brien-3
Well you know that temporary variables in a Workspace have to start lower case. And upper case words are expected to be classes. x := Date new. Glad to hear you figured it out. Chris On 2012-06-15, at 1:43 PM, James O'Brien wrote:
_______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Free forum by Nabble | Edit this page |