[Newbies] Re: problems moving and resizing quadrangles

Alan Gauld alan.gauld at btinternet.com
Thu Dec 29 11:43:57 UTC 2011

On 28/12/11 10:12, Alan Gauld wrote:
> In my tutorial I've been building a quadrangle editor.

Some progress, move now works:

    at: 1
    put: [:q | self
	at: (self whichIndex: q)
	put: (q translateBy: Point fromUser - q origin)].

My previous version was actually moving it but moving it off the display 
so it looked like it had been killed.

BTW Apologies if the formatting is getting lost (as per below) I'm 
supposed to be using plain text according to Thunderbird!

Now for resize...

> Here is the menu building code that holds the critical blocks.
> What I'm trying to do in both cases is create a new quadrangle from the
> original and replace the original in the OrderedCollection which is the
> super class for the editor.
> edit
> "edit a quadrangle"
> | menu cmdMenu quadMenu finished point
> actions quadActions cmdActions select qd |
> quadMenu := PopUpMenu labels: 'move
> resize
> set to red
> delete' lines: #(3 ).

> quadActions
> at: 2
> put: [:q | self
> at: (self whichIndex: q)
> put: (q scaleBy: Point fromUser)].

Alan G
Author of the Learn to Program web site

More information about the Beginners mailing list