On 28/12/11 10:12, Alan Gauld wrote:
In my tutorial I've been building a quadrangle editor.
Some progress, move now works:
quadActions 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)].