{curl 7.0 applet}

{VBox halign = "center", spacing = 1cm,
    {HBox spacing = 2cm,

        || The following four objects are dragees, of two
        || different types (EllipseGraphic and RectangleGraphic).
        {RectangleGraphic
            width = 10mm, height = 14mm, dragee = {ImageDragee}},
        {EllipseGraphic
            width = 14mm, height = 10mm, dragee = {ImageDragee}},
        {RectangleGraphic
            width = 4mm, height = 16mm, dragee = {ImageDragee}},
        {EllipseGraphic
            width = 10mm, height = 14mm, dragee = {ImageDragee}
        }
    },
    {TextFlowBox        || The drop target.
        border-width = 2pt, border-color = "black", margin = 5pt,
        {text font-size = 16pt,
            Please drop {bold round} objects on this box},

        || The following code handles the DragOver event.
        || Any dragee can be dropped on this drop target.
        {on e:DragOver do
            {e.will-accept-drop?
                {proc
                    {type:Type,
                     x:Distance,
                     y:Distance,
                     effect:#DragEffect
                    }:DragEffect
                    {return drag-effect-copy}
                }
            }
        },

        || The following code handles the Drop event.  The
        || 'action' taken depends on the criteria in this 'if'
        || expression.  Note that the name of the first argument
        || in the procedure that returns the DropResult (a) refers
        || to the dragee.
        {on e:Drop do
            {e.accept-drop
                {proc
                    {a:any,
                     x:Distance,
                     y:Distance,
                     effect:#DragEffect}:DropResult
                    {return
                        {DropResultCopy
                            action =
                                {proc {}:void
                                    {if a isa EllipseGraphic then
                                        {popup-message
                                            modal? = true,
                                            "Correct.  The object is round."}
                                     else
                                        {popup-message
                                            modal? = true,
                                            "Wrong!  The object is not round."}
                                    } 
                                } 
                        } 
                    } 
                } 
            } 
        } 
    }
} 
