Hi~
I'm new to FLTK and I just want to change the label of Fl_Input when I press
the button. However the label changed to a strange string instead of what I
want.
Any idea?
The code :
--------------------------------------------------------
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <fl/Fl_Input.H>
#include <FL/Fl_Button.H>
int n=0;
int i;
void changelabel(Fl_Widget*ptr)
{
char l[15];
Fl_Window *win = (Fl_Window *)((Fl_Button*)ptr->parent());
Fl_Input *input = (Fl_Input*)win->child(i);
sprintf_s(l,"p :=: ");
input->label(l);
n++;
}
int main()
{
Fl_Window *win = new Fl_Window(200,100,"try");
win->begin();
Fl_Input *input = new Fl_Input(70,20,80,30," hh");
Fl_Button *btn = new Fl_Button(30,60,150,30,"go");
btn->callback(changelabel);
win->end();
i = win->find(input);
win->show();
return(Fl::run());
}
----------------------------------------------------------
I use Win7, VS2010
Thank you for help
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk