> I found the solution for my problem, but don't really understand why
> it works. From the following callback function for tree browser I
> deleted the case FLU_WIDGET_CALLBACK and it works fine. But I don't
> see much difference in what is happening.
>
> void treeCallBack(Fl_Widget* o, void* v)
> {
>       .....***...
>
>       /*case FLU_WIDGET_CALLBACK:
>               printf( "%s widget callback\n", n->label() );
>               break;*/
>       }
> }

Are you by any chance creating the label at run-time using a char array
that is local to a function or method, or which could be overwritten?
Eg, you have some function containing:

    char buffer[100];
    sprintf(buffer, "widget %d", d);
    widgetX->label(buffer);

If that is the case, then the buffer variable is going out of scope
at the end of the function, and the contents are likely to be reused.
What you should to here is use copy_label() instead of label().

See 
http://www.fltk.org/documentation.php/doc-1.1/Fl_Widget.html#Fl_Widget.copy_label

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to