Edward ffolliott Hull wrote:
> I'm playing with writing a 'map viewer' for role-playing games using
> grids or hexagonal cells.  As these are all tightly packed, at the
> moment I am subclassing Fl_Button (FLTK 1.1.8/suse 11.0), specifying the
> dimensions as the rectangular area and drawing out-side of the bounding
> box.

        No, draw /inside/ the bounding box.
        Widgets should not draw outside their xywh.
        
> This results in the triangular ends not being active.  I would like
> to implement a hexagonal button but need a few pointers as to
> controlling the 'clickable' area of a widget.

        If you're deriving from Fl_Button, the sensitive area
        will be the entire xywh area.

        I'd think you'd be OK not to have to bother limiting the
        clickable area away from the small triangles around the hexagon.

> For information, previously I was drawing the hexagon entirely inside
> the boundary, but this results in overlapping boundaries. 

        Not sure what you mean by overlapping boundaries. Don't
        overlap the widget areas (xywh) when you create the buttons
        and all should work well.

> Inactive
> regions are better than this, but I would ideally like to solve the
> clickable region issue.

        If you really want to go there, you can probably overload the
        handle() method, and on mouse clicks, check to see if the xy
        position of the mouse is inside one of those triangles, and if
        so, ignore the clicks by not passing the events on to the
        Fl_Button::handle() from your handler, effectively 'masking'
        those regions.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to