As the demo program follows, the button' callback could not resize the input
widgets, why? while in second demo program the button callback could resize
itself. thx!
#include <fltk/Window.h>
#include <fltk/Button.h>
#include <fltk/Group.h>
#include <fltk/Input.h>
#include <fltk/run.h>
using namespace fltk;
void button_cb (Widget *w, void* v);
void input_cb (Widget *w, void* v);
class g : public Group {
public:
Input *input;
Button *button;
g(int x, int y, int w, int h, char*l=0):Group(x,y,w,h,l){
begin();
//box(THIN_DOWN_BOX);
input = new Input(100,20,40,40,"OK");
input->hide();
//input->box(THIN_DOWN_BOX);
input->callback(input_cb, (void*)this);
button = new Button(10,20,40,40,"OK");
button->callback(button_cb, (void*)this);
end();
}
~g(){}
};
void input_cb (Widget *w, void* v) {
g* s = (g*)v;
//s->input->value("sss\n");
}
void button_cb (Widget *w, void* v) {
g* s = (g*)v;
s->input->resize(40,100, 40, 120);
s->input->show();
}
int main(){
int w_window = 600;
int h_window = 400;
Window window(w_window, h_window, "hhh");
window.begin();
g ge(20, 20, window.w()-80, window.h()-80, 0);
//window.add(ge);
window.end();
window.resizable(window);
window.show();
return run();
}
// #include <fltk/run.h>
// #include <fltk/Window.h>
// #include <fltk/Button.h>
// using namespace fltk;
// void cb(Widget *w,void *){
// w->resize(100,10,190,35);
// }
// int main(void){
// Window *window = new Window(320,65);
// Button b1(0,0,320,65,"Resize me");
// b1.callback(cb);
// window->add(b1);
// window->end();
// window->show();
// return run();
// }
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk