Greg Ercolano wrote:
> Lisa Rapchick wrote:
>> I have a 12-key "keypad"
>> 1 2 3
>> 4 5 6
>> 7 8 9
>> * 0 #
>> [..]
>> However, the FL_PUSH/RELEASE events are (no longer) being seen by digits 
>> 2,3,8 and 9.
> 
>       [..] make sure the buttons aren't positioned outside a parent's xywh 
> extents.
> 
>       IIRC, Fl_Group by default does not clip children that are outside of
>       its xywh extents, such that the children may draw correctly, but events
>       /will/ be clipped, possibly causing the problem you're describing.
> 
>       One way to easily debug is to change the color of the parent group(s)
>       and set their boxtype to a flat box type, so that you can see their
>       borders, and thus see if the buttons are drawing beyond those areas.

        This is probably best shown by example.

        Compile + run the following, and push the number buttons;
        the 9/6/3 buttons won't 'push'.

        Push the 'Why..?' button which changes the Fl_Group's color
        (as described above) to see the buttons' positions relative
        to the group, which shows the 9/6/3 buttons outside the parent.

        The buttons still draw because Fl_Group doesn't clip by default,
        but the children outside the group won't receive events.

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Button.H>
//
// Demonstrate clipping problem with widgets outside their parent's xywh extents
// erco 04/20/08
//
Fl_Window *win = 0;
Fl_Group  *grp = 0;
void Why_CB(Fl_Widget*, void*) {
    grp->box(FL_FLAT_BOX);
    grp->color(FL_RED);
    win->redraw();
}
int main() {
    win = new Fl_Window(500,500);
    grp = new Fl_Group(5,5,100,155);
    new Fl_Button(10,10 ,40,40,"7"); new Fl_Button(60,10 ,40,40,"8"); new 
Fl_Button(110,10 ,40,40,"9");
    new Fl_Button(10,60 ,40,40,"4"); new Fl_Button(60,60 ,40,40,"5"); new 
Fl_Button(110,60 ,40,40,"6");
    new Fl_Button(10,110,40,40,"1"); new Fl_Button(60,110,40,40,"2"); new 
Fl_Button(110,110,40,40,"3");
    grp->end();
    Fl_Button *but = new Fl_Button(100, 400, 300, 25, "Why doesn't 9,6,3 
work?");
    but->callback(Why_CB);
    win->end();
    win->show();
    return(Fl::run());
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to