If you set the label property of a widget using label(), it only stores the 
pointer you pass it - it does not copy the string. Use copy_label() instead, or 
make tmp[] static.
I think that's your problem.

> At first, excuse me for my bad english.
> I begin with FLTK.
>
> I have a box with an image as background.
> On this image I have put box label to write some values.
> When I try to change to value of the label in the call back, I have
> strange result the first time and after nothing happens.
> I don't understand.
>
> Here is a part of my callback code
>
> char tmp[10];
> sprintf(tmp, "%.2g\0", monfiltre->getcapah());
> cb_data->c1->label(tmp);
> cb_data->c1->clear_visible();
> cout<<"Temp="<<cb_data->c1->label()<<"--"<<tmp<<endl;
> sprintf(tmp, "%.2g\0", monfiltre->getselfh());
> cb_data->s1->label(tmp);
>
> Note that the "cout"  give me the good values.
>
> Thanks for your help,
>
> Regards,
> --
> Marc Gavage
>
> Tu quoque fili mi!
>

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

Reply via email to