Re: fl_show_form in callback file

Steve Lamont (spl@szechuan.ucsd.edu)
Thu, 23 Jan 97 06:25:17 PST

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

> But It dumps core when the callback button is pressed!
>
> Below is the code from the callback file produced by 'fdesign' with three
> lines of added code by myself.
>
> Is there anything else I need to just fire up a screen from this callback?
>
>
> void main_history(FL_OBJECT *ob, long data)
> {
> FD_history_yn *fd_history_yn; // copied from x_main.c to define
> // to define history_yn.
>
> fl_show_form(fd_history_yn->history_yn,FL_PLACE_CENTER,FL_FULLBORDER,"X");
> }

How have you created fd_history_yn? This pointer is probably garbage
if the code is exactly as shown since fd_history_yn is an *automatic*
variable created when main_history() is entered. The value of
automatics is undefined.

Perhaps what you want do is:

FD_history_yn *fd_history_yn;

int main( int argc, char **argv )

{

fd_history_yn = create_form_history_yn();

[...]

fl_do_forms();

}

[...]

void main_history(FL_OBJECT *ob, long data)
{

extern FD_history_yn *fd_history_yn; // copied from x_main.c to define
// to define history_yn.
fl_show_form(fd_history_yn->history_yn,FL_PLACE_CENTER,FL_FULLBORDER,"X");

}

That way fd_history_yn gets initialized with something useful.

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html