[racket] onfocus like functionality in Racket

From: Jordan Johnson (jmj at fellowhuman.com)
Date: Sun Oct 5 02:21:43 EDT 2014

1. One cause of confusion: world-after-button-down and world-after-button-up are under-specified in your purpose statements (i.e. "RETURNS:" comments): rather than "the world following a button-up event", which is vague and open to multiple interpretations, say what behavior you wish to observe (and then codify that behavior in your test cases). Get specific: what happens when the button is pressed while the cursor is in one ball? multiple balls? no balls?

This vagueness is in some of your other functions, too.

2. The "structural decomposition on w : World" isn't what's going on. Your function is really a structural decomposition of the list of balls, and this is obscured by the way you are recurring on a World.

Rule of thumb: never rebuild something just so you can recur on a smaller version of one of its parts.

Best,
Jordan

> On Oct 4, 2014, at 7:50 PM, Animesh Pandey <animeshpandey.etno at gmail.com> wrote:
> 
> Hi,
> I have designed the program. You can see this here. It is a basic GUI program where I generate figures using a key event. The figures can be dragged but I noticed one thing which was if any of the figures overlap then when the figure which is on top is dragged the one below is also dragged. You run it with (run 0) and then press 'n' to generate new figures on the center of the canvas.
> 
> 
>> On Sat, Oct 4, 2014 at 9:50 PM, Matthias Felleisen <matthias at ccs.neu.edu> wrote:
>> 
>> Yes, it's your choice whether one circle moves or both.
>> 
>> If this is related to a course, you need to design the program so that this mailing list can help you with where you're stuck.
>> 
>> If you're trying to find a good GUI toolbox, then I'd recommend using the underlying one instead. The big-bang construct is used for teaching design.
>> 
>> 
>> On Oct 4, 2014, at 9:47 PM, Animesh Pandey wrote:
>> 
>> > Hi,
>> > I am using big-bang to create a simple GUI application where I am dragging two solid circles.
>> > Suppose I drag one circle on top of another and release the mouse button and then when I click both circles move together. Is there away I can avoid this? I want the circle on the top to move and not the one under it.
>> >
>> > Thanks
>> > ____________________
>> >  Racket Users list:
>> >  http://lists.racket-lang.org/users
> 
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141004/d7480aac/attachment-0001.html>

Posted on the users mailing list.