On 01/05/12 06:13, David Lopez wrote:
> Hello,
> I have a property dialog including a tree, so I need that when the dialog is 
> shown a given item in the tree is selected and visible (tree scrolled 
> beforehand) to reflect current property state.
> The problem is that neither display() nor show_item() work until the tree 
> (and dialog) are visible.
> What's the way to do this?
> Thanks

        I think Fl_Browser has the same issue for the same reason;
        if the widget hasn't drawn itself yet, its internal variables
        haven't yet been calculated.

        Probably the thing to do is to split up the draw() code
        so that the widgets internals can be pre-calculated
        just before display()/show_item() run their effective code.

        For now, I'd say you'd have to do what other apps do with
        the other widgets that have this issue; wait until the widget
        has been drawn before calling these methods.

        There's a few ways to do this; timers, or making a small
        event loop that calls Fl::wait() until the widget has been
        draw()n, then you can make your calls to these methods
        before returning to the regular event loop.

        Perhaps the other devs can chime in on this,
        as I can't remember all the ways this is normally handled.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to