9 Creating Your Own Panes
When the event callback is called, it gets passed the output-pane and the x and y coordinates of the mouse pointer at the time of the event. A few events also pass additional information as necessary; for example, keyboard events also pass the key that was pressed.
For example, we can create a very simple drawing pane by adding a callback to draw a point whenever the left button is dragged across the pane. This is done as follows:
(contain (make-instance 'output-pane :input-model '(((:motion :button-1) gp:draw-point))))
Figure 9.3 An interactive output pane
The input model above seems quite complicated, but it is just a list of event to callback mappings, where each one of these mappings is a list containing an event specification and a callback. An event specification is also a list containing keywords specifying the type of event required.
Generated with Harlequin WebMaker