routine PALETTE.CTL given FIELD.ID, FORM yielding STATUS
''
'' COPYRIGHT (C) 1993, CACI Products Company.
'' AUTHOR: Steve Bailey
'' DATE: 2-29-95
'' DESCRIPTION:
''     Control routine for the palette (passed to ACCEPT.F).  This routine is
''     called whenever the user selects ANY palette item. 
''     The programmer defines the reference names for the palette buttons
''     in simdraw.  When one of these items is clicked on by 
''     the user, this same reference name appears here as the FIELD.ID.
''
''     The palette buttons are "draggable" meaning that the callback is
''     not made until the user has let up on the mouse button within the
''     window canvas.  At this point, create a new bouncing ball!

define FORM as a pointer variable
define FIELD.ID as a text variable
define STATUS as an integer variable

  '' if a button is being raised, depress the first button
select case FIELD.ID
  case "INITIALIZE", "BACKGROUND"   '' not used

  default  '' "CLOWN", "BALL", "COMPUTER", "EARTH"
      '' an object was dropped from the palette to the canvas.
    create a BALL

      '' display the new object in the window
      '' DINPUT.V will contain the drop location.
    display BALL with LOWER.F(FIELD.ID) at 
            (LOCATION.X(DINPUT.V), LOCATION.Y(DINPUT.V))

      '' start bouncing the object
    activate the BALL now
endselect
        
let STATUS = 0  '' never return from accept.f
let FORM = FORM

return
end
