/* * Size Buttons * ------------ * This program demonstrates the use of a resize callback to * automatically resize some widgets. * * If a window is resized, the window's resize callback happens. * When this occurs we use the 'resize' function to move some * buttons and text fields around. * */ #include window w; textbox t; button b; void resize_it(window w, rect r) { resize(t, rect(20, 20, r.width-40, r.height-90)); resize(b, rect(r.width-100, r.height-50, 80, 30)); } void quit(button b) { exitapp(); } void main(void) { window w; w = newwindow("Resize me", rect(0,0,400,350), StandardWindow); t = newtextbox("", rect(20,20,360,260)); b = newbutton("Quit", rect(300,300,80,30), quit); setresize(w, resize_it); show(w); mainloop(); }