[Newbies] Re: Hi there! (and my first problem)

Filip Malczak filet00 at gmail.com
Tue Nov 25 05:45:20 UTC 2008


Thanks ;) In deed - I found it out yesterday evening, but couldnt try (I
just thought of the whole structure ;) ). Once again: thanks.

2008/11/24 Michael van der Gulik <mikevdg at gmail.com>

>
>
> On Tue, Nov 25, 2008 at 5:25 AM, Filip Malczak <filet00 at gmail.com> wrote:
>
>> 2008/11/23 Filip Malczak <filet00 at gmail.com>
>>
>> Hi, Im Filip, and Im new at squeak. Ive read 'Squeak by example', and now
>>> I try to make my first program. Ive already written in Pascal and a bit
>>> (really small bit) of C. Im from Poland, so my english can by not realy
>>> good.
>>>
>>> Now time for my problem:
>>> I wanna write a program to write notes on stave (for music). Later Im
>>> gonna add translating notes into tabulatures for guitar, and later - for
>>> flute. But I begin with just notes.
>>> I started from creating object 'Pieciolinia' which is stave (in polish).
>>> Then I found out I need some tool to change metrum (Im not sure if its the
>>> same in english and polish, its speed of song, written on begining of stave,
>>> just after treble clef). So I made class 'TempoButton' which is expected to
>>> contain 3 smaller buttons: gora, dol & strzalka. gora is top number of
>>> metrum, dol - bottom number and strzalka is button to show a list of usual
>>> metrums (you click it and you have a list). gora and dol should open
>>> FillInTheBlank and change itself captions to what is written by user, and
>>> strzalka should open a PopUpMenu with list of some metrums.
>>> Then I created class 'SkladowyButton' which is my version of Basic Button
>>> (I wasnt able to find out how to handle with it, so I tried to create new
>>> one. And I could make up my own outlook for button).
>>> Ive written some methods, but when I try to execute (do it with ctrl+d):
>>>
>>> but:=TempoButton new.
>>> but drawOn: World.
>>>
>>> I have debugger as on zrzut1.jpg (I send it).
>>>
>>
> Hi Filip.
>
> You're calling >>bounds: on a Rectangle, which it doesn't understand.
>
> Open up a Browser and find the "Rectangle" class. This will show all the
> method selectors that Rectangle understands.
>
> If you bring up a halo for any morph on the screen (middle-click,
> right-click alt-click or whatever depending on platform), select "Debug" and
> then "inspect morph", then type in "self bounds" in the text space at the
> bottom of the inspector window and press "alt-i", you'll see that calling
> >>bounds on any Morph instance returns a Rectangle.
>
> So, in your code, you can simply do:
>
> rec := aMorph bounds.
>
> Or even more simply, remove the "rec" instance variable and do:
>
> aCanvas fillRectangle: (self bounds) color: (self color).
>
> I like using parenthesis to make the arguments stand out more. You don't
> need them if you don't want them.
>
> Note also that Rectangle is an immutable class. Its methods return copies
> of itself.
>
> Gulik.
>
>
> --
> http://people.squeakfoundation.org/person/mikevdg
> http://gulik.pbwiki.com/
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>


-- 
Pozdrawiam:
Filip
GG: 2486889
mail: filet00 at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20081125/6e740730/attachment.htm


More information about the Beginners mailing list