RE: XForms: another thing...

Steve Lamont (spl@szechuan.ucsd.edu)
Thu, 17 Sep 98 11:54:04 PDT

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> ooh ..sorry,.I think I didn't explain my self good. I -do- call
> fl_show_form(...) every time I need a form to be displayed. But unless I
> create it again, I get that above mention Xforms error..
>
> Also... my most of my forms have input boxes.. and when you hide the form,
> and then show it again.. the contents of the input boxes are empty (if
> they had been inputted). Is there any way around this? This forces me to
> store all of the information on the form to a data struct before I hide
> and show the next form...

You have something very fundamentally wrong. This is not expected or
correct behavior for XForms.

I just banged together a little test program which displays and hides
a window with four input objects in it. The inputs stay around (as
they should) and there's no problem with any X errors being generated.

Try building that and see if you still have problems. If you do, then
I suspect you have some error in your XForms installation -- say
library skew or library incompatibility (libc vs libforms, for instance).

spl

- - - try_main.c - - -
#include "forms.h"
#include "try.h"

/* callbacks and freeobj handles for form main_form */
void hide_show_cb(FL_OBJECT *ob, long data)

{

FD_input_form *fd_input_form = ( FD_input_form *) ob->u_vdata;

if ( fd_input_form->input_form->visible ) {

fl_set_object_label( ob, "Show" );
fl_hide_form( fd_input_form->input_form );

} else {

fl_set_object_label( ob, "Hide" );
fl_show_form(fd_input_form->input_form,
FL_PLACE_FREE | FL_FIX_SIZE,FL_FULLBORDER,"input_form");

}

}

void quit_cb(FL_OBJECT *ob, long data)
{

FD_input_form *fd_input_form = ( FD_input_form *) ob->u_vdata;

fprintf( stderr, "input 1 = `%s'\n",
fl_get_input( fd_input_form->input_1 ) );
fprintf( stderr, "input 2 = `%s'\n",
fl_get_input( fd_input_form->input_2 ) );
fprintf( stderr, "input 3 = `%s'\n",
fl_get_input( fd_input_form->input_3 ) );
fprintf( stderr, "input 4 = `%s'\n",
fl_get_input( fd_input_form->input_4 ) );

exit( 0 );

}

/* callbacks and freeobj handles for form input_form */

int main(int argc, char *argv[])
{

FD_main_form *fd_main_form;
FD_input_form *fd_input_form;

fl_initialize(&argc, argv, 0, 0, 0);
fd_main_form = create_form_main_form();

fd_main_form->quit_button->u_vdata =
fd_main_form->hide_show_button->u_vdata =
fd_input_form = create_form_input_form();

fl_set_object_label( fd_main_form->hide_show_button, "Show" );

fl_show_form(fd_main_form->main_form,
FL_PLACE_CENTERFREE,FL_FULLBORDER,"main_form");
while ( 1 )
fl_do_forms();

}

- - - try.fd - - -
Magic: 13000

Internal Form Definition File
(do not change)

Number of forms: 2
Unit of measure: FL_COORD_PIXEL

=============== FORM ===============
Name: main_form
Width: 320
Height: 250
Number of Objects: 3

--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 320 250
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 40 40 230 80
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_BOLDITALIC_STYLE
size: FL_HUGE_SIZE
lcol: FL_BLACK
label: Hide
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: hide_show_button
callback: hide_show_cb
argument: 0

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 40 140 230 80
boxtype: FL_UP_BOX
colors: FL_RED FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_BOLDITALIC_STYLE
size: FL_HUGE_SIZE
lcol: FL_BLACK
label: Scram!
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: quit_button
callback: quit_cb
argument: 0

=============== FORM ===============
Name: input_form
Width: 320
Height: 250
Number of Objects: 5

--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 320 250
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:

--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 80 30 200 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
style: FL_BOLDITALIC_STYLE
size: FL_MEDIUM_SIZE
lcol: FL_BLACK
label: Input 1
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: input_1
callback:
argument:

--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 80 80 200 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
style: FL_BOLDITALIC_STYLE
size: FL_MEDIUM_SIZE
lcol: FL_BLACK
label: Input 2
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: input_2
callback:
argument:

--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 80 130 200 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
style: FL_BOLDITALIC_STYLE
size: FL_MEDIUM_SIZE
lcol: FL_BLACK
label: Input 3
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: input_3
callback:
argument:

--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 80 180 200 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
style: FL_BOLDITALIC_STYLE
size: FL_MEDIUM_SIZE
lcol: FL_BLACK
label: Input 4
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: input_4
callback:
argument:

==============================
create_the_forms
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/