# To subscribers of the xforms list from Steve Lamont <spl@ncmir.ucsd.edu> :
> I use FL_PLACE_FREE to show a form on screen. Unfortunately,
> the size of objects do not follow the size of the form while showing. To
> make them resize correctly, I must change the size of the form again.
> The gravity is mainly NW/SE within the objects.
How are you resizing the form? With fl_set_form_size()? That should
work.
The following quick and dirty example I banged together in about a
minute and a half shoud be of use.
It expands and contracts the form with alternate presses of the
"Resize" button.
spl
- - -
#include <forms.h>
extern void quit_cb(FL_OBJECT *, long);
extern void resize_cb(FL_OBJECT *, long);
/**** Forms and Objects ****/
typedef struct {
FL_FORM *try;
void *vdata;
char *cdata;
long ldata;
} FD_try;
extern FD_try * create_form_try(void);
#include <stdlib.h>
FD_try *create_form_try(void)
{
FL_OBJECT *obj;
FD_try *fdui = (FD_try *) fl_calloc(1, sizeof(*fdui));
fdui->try = fl_bgn_form(FL_NO_BOX, 240, 190);
obj = fl_add_box(FL_UP_BOX,0,0,240,190,"");
obj = fl_add_button(FL_NORMAL_BUTTON,20,20,200,60,"Quit");
fl_set_object_callback(obj,quit_cb,0);
obj = fl_add_button(FL_NORMAL_BUTTON,20,110,200,60,"Resize");
fl_set_object_callback(obj,resize_cb,0);
fl_end_form();
fdui->try->fdui = fdui;
return fdui;
}
/*---------------------------------------*/
/*** callbacks and freeobj handles for form try ***/
void quit_cb(FL_OBJECT *ob, long data)
{
exit( 0 );
}
void resize_cb(FL_OBJECT *ob, long data)
{
FL_FORM *form = ob->form;
static float x = 2.0;
fl_set_form_size( form,
( FL_Coord ) ( form->w * x ),
( FL_Coord ) ( form->h * x ) );
x = 1.0 / x;
}
int main(int argc, char *argv[])
{
FD_try *fd_try;
fl_initialize(&argc, argv, 0, 0, 0);
fd_try = create_form_try();
/* fill-in form initialization code */
/* show the first form */
fl_show_form(fd_try->try,FL_PLACE_CENTERFREE,FL_FULLBORDER,"try");
fl_do_forms();
return 0;
}
- - -
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuhs.mil or see
http://bob.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://world.std.com/~xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/
This archive was generated by hypermail 2b29 : Thu Mar 08 2001 - 10:17:01 EST