Stan wrote:
> Thanks Greg & Matt for your thorough explanation.  However,
> go back to the compilable example and replace the line
>   new Outer(475, 40, 20, 20, "Your Message Here");
> with
>   new Inner(475, 40, 20, 20, "Your Message Here");

        With the above modification, the widget is just drawing
        the label outside its own perimeter, not outside its parent.
        The key word here being "parent":

Greg wrote:
>    This is normal; FLTK does not guarantee predictable behavior
>    if a child draws outside the bounds of its parent(s). This breaks
>    the rule of how window damage is calculated.

        In simple cases, a widget may draw outside its own perimeter
        and depend on damage to its immediate parent to tell it to redraw.

        (hope you're reading in fixed width font; here comes some ascii-art)

        For instance, when FL_ALIGN_INSIDE is not specified, the label
        for the widget will draw outside the widget's perimeter, such
        as this simple case of an Fl_Input inside a window:

    ______________________________________________________
   | Window                                               |
   |------------------------------------------------------|
   |                                                      |
   |                     -----------------------          |
   |    My Input Field: |                       |         |
   |                     -----------------------          |
   |______________________________________________________|

        The key here is the Fl_Input is positioned to account for the
        floating label; the widget has been positioned so that the label
        fits /inside/ its parent, and doesn't float off the edge of the
        window.

        This seems obvious, but it's the point that's missed in the
        original example.

        The same rule goes for more complex hierarchies; if the
        Fl_Input is then placed inside a parenting group, it must
        be positioned such that it and its label are /inside/ the group, eg:

    ______________________________________________________
   | Window                                               |
   |------------------------------------------------------|
   |  Group                                               |
   |  ------------------------------------------------    |
   | |                   -----------------------      |   |
   | |  My Input Field: |                       |     |   |
   | |                   -----------------------      |   |
   |  ------------------------------------------------    |
   |______________________________________________________|


        What would be bad is if the Fl_Input is placed inside the group
        such that the floating label is /not/ accounted for, which is
        what is what is wrong with the original example:

    ______________________________________________________
   | Window                                               |
   |------------------------------------------------------|
   |                   Group                              |
   |                   ------------------------------     |
   |                  |  -----------------------     |    |
   |    My Input Field: |                       |    |    |
   |                  | -----------------------      |    |
   |                   ------------------------------     |
   |__________________^___________________________________|
                      |
                      Group is clipping off the label

        This is bad, and what the original example showed.

        For predictable redraw behavior, children must have all their
        graphics drawn within the perimeter of their parent. It's an
        easy rule to remember, and makes sense. Just be sure to apply
        it, even in complex hierarchies.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to