About Handling Image Buttons and Tiles (DCL)

You can handle an image button simply as a button—that is, you can use it to trigger a single action.

However, you can also use the PDB feature to define regions of the button. With regions defined, the action taken depends on the part of the image button the user selects. The mechanism for this is straightforward: an image button's action or callback returns the (X,Y) location that the user selected. The coordinates are within the range of the particular image button tile (as returned by the dimension functions). Your application must assign a meaning to select locations by implicitly defining regions of the image. The DDVPOINT dialog box makes good use of this feature. You can view this by running the AutoCAD DDVPOINT command.

In the following example, your image button has two color swatches created by fill_image. You want to select either one or the other, depending on which region the user selects. If the image button is divided horizontally (dark above and light below), your action needs to test only the one dimension:

(action_tile "image_sel" "(pick_shade $key $value $y)")
...
(defun pick_shade (key val y)
  (setq threshold (/ ( dimy_tile key) 2)) ;Image is divided horizontally.
  (if (> y threshold)                     ;Remember that the origin is at
    (setq result "Light")                 ;upper left.
    (setq result "Dark")
  )
)