yu zhiqiang wrote:
> i write a program using resize function. but the widget does not being
> resized why?
>
You should really post this kind of questions to fltk.general.
Nevertheless...
You missed the window.resizable(window) call
FLTK2 does not impplicitly call begin(), if you do it yourself then you
don't need window.add(ge)
Your example does not even compile without some tweaking.
This is a revised version:
#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 gp : public fltk::Group {
public:
fltk::Button *b;
gp(int x, int y, int w, int h, char*l=0):fltk::Group(x,y,w,h,l,true){
box(THIN_DOWN_BOX);
b = new Button(10,20,40,40,"OK");
b->callback(button_cb, (void*)this);
}
~gp(){}
};
class g : public gp {
public:
Input *input;
g(int x, int y, int w, int h, char*l=0):gp(x,y,w,h,l){
//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);
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(20,100, 40, 120);
//s->input->set_damage(DAMAGE_ALL);
s->input->show();
//s->update_child((Widget&)*(s->input));
//((g*)s->input)->value("sss\n");
}
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();
}
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev