Re: XForms: closing dialog boxes...

From: Steve Lamont (spl@szechuan.ucsd.edu)
Date: Sun Mar 19 2000 - 18:30:32 EST

  • Next message: David J. Singer: "Re: XForms: closing dialog boxes..."

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

    > > fl_set_atclose() and fl_set_form_atclose() are your friends.
    >
    > Hmmm. Yes, I looked at fl_set_form_atclose() but unless I'm missing
    > something it seems a lot of hassle, if you have many pop-up forms,
    > to register a callback for each one simply to stop the main application
    > program exiting when a form is closed...

    Not necessarily.

    If you just want a blanket protection against the application
    inadvertently being closed by the user, use fl_set_atclose():

            fl_initialize( ... );
            fl_set_atclose( never_die, NULL );

            [...]

        int never_die( FL_FORM *form, void *data )

        {

            return FL_IGNORE;

        }

    That's pretty easy, isn't it?

    If you want to exit only when closing the main form, you can do

            FD_main *main;

            fl_initialize( ... );

            main = create_form_main();

            fl_set_atclose( die_only_in_main, ( void *) main->main );

            [...]

        int die_only_in_main( FL_FORM *form, void *data )

        {

            FL_FORM *main = ( FL_FORM *) main;

            return main == form ? FL_OK : FL_IGNORE;

        }

    As Al "Jazzbo" Collins used to say, "easy for you."

                                                            spl
    _________________________________________________
    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 : Sun Mar 19 2000 - 18:34:04 EST