Re: XForms: Re: Splash Screen

Steve Lamont (spl@szechuan.ucsd.edu)
Mon, 25 May 98 13:55:22 PDT

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

> here is my main() function....I hope this explains things a little better than me.
>
> int
> main (int argc, char *argv[])
> {
> display = fl_initialize (&argc, argv, "Menu", 0, 0);
> fdui_splash = create_form_splash();
> fl_show_form (fdui_splash->splash,FL_PLACE_FREE_CENTER,FL_NOBORDER,"Splash");
> if (hide_splash)
> {
> fdui = create_form_menu ();
> fl_set_form_position (fdui->menu, 100, 100);
> fl_show_form (fdui->menu,FL_PLACE_POSITION,FL_FULLBORDER,"Menu");
> fl_do_forms ();
> }
> return 0;
>
>
> (hide_splash is the callback of the pixmap button (splash screen) which simply
> hides and frees the form.)

This is totally wrong. If `hide_splash' is, indeed, a function name,
then it will always be non-zero and, thus, the if() clause will always
get executed, which will immediately crate the menu.

You should do something like (somewhat schematically)

fl_show_form( your_splash_form... )

fl_do_forms();

...

void hide_splash( FL_OBJECT *obj, long data )

{

FD_menu *menu = create_form_menu();

fl_free( obj->form->fdui );

fl_hide_form( obj->form );
fl_free_form( obj->form );

fl_show_form( menu->menu ... );

}

(Note: It's okay to free the fdui structure before the form itself
since you're not referencing it and the innards of XForms don't
reference it as far as I can tell.)

You need to commune with the manual.

spl
_________________________________________________
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/