[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XForms] Closing of sub forms

From: Michal Szymanski
Subject: Re: [XForms] Closing of sub forms
Date: Sun, 20 Nov 2022 18:31:55 +0100
User-agent: Mutt/1.5.20 (2009-12-10)


It is a bit annoying but it is just so. To prevent the application
from exiting when the WM Close Button (typically X) is clicked on a
sub-form, you need to set a special callback for all those subforms
using fl_set_form_atclose() function.

Consult section 4.1 of XForms manual (e.g.
This is an excerpt:

Window managers typically have a menu entry labeled "delete" or
"close" meant to terminate an application program gently by informing
the application program with a WM_DELETE_WINDOW protocol message.
Although the Forms Library catches this message, it does not do
anything except terminating the application. This can cause problems
if the application has to do some record keeping before exiting. To
perform record keeping or to elect to ignore this message, register a
callback function using the following routine

int fl_set_atclose(int (*at_close)(FL_FORM *, void *), void *data);

The callback function at_close will be called before the Forms Library
terminates the application. The first parameter of the callback
function is the form that received the WM_DELETE_WINDOW message. To
prevent the Forms Library from terminating the application, the
callback function should return the constant FL_IGNORE. Any other
value (e.g., FL_OK) will result in the termination of the application.

Similar mechanism exists for individual forms

int fl_set_form_atclose(FL_FORM *,
                        int (*at_close)(FL_FORM *, void *),
                        void *data);

except that FL_OK does not terminate the application, it results in
the form being closed. Of course, if you'd like to terminate the
application, you can always call exit(3) yourself within the callback

regards, Michal

On Sun, Nov 20, 2022 at 04:33:53PM +0100, Ruud Warmoeskerken wrote:
> Hello,
> I made an application that uses sub forms.
> The windows are displayed used the fl_show_form(  ) call and everything works 
> fine.
> Except, when I close a sub form with the standard close button that is 
> displayed in the border of the sub form (X) , the main application (and all 
> other sub forms) are closed automatically.
> It is if the application is killed from within the window manager.
> If I close the sub form using a fl_hide_form(  ), all works as it should.
> I developed this application on a MacOS environment but the behaviour is 
> exactly the same on a Linux pc.
> I studied the demo-programms and read the Forms 1.2 manual, but it seems I 
> can’t figure out how to do it.
> Probably it has to do with some options I have to give to the window manager, 
> but I can’t ind out how.
> Does anyone have an idea how to do it?
> Kind regards 
> Ruud Warmoeskerken
> (ruud.warmoeskerken@skynet.be <mailto:ruud.warmoeskerken@skynet.be>)

  Michal Szymanski (msz at astrouw dot edu dot pl)
  Warsaw University Observatory, Warszawa, POLAND

reply via email to

[Prev in Thread] Current Thread [Next in Thread]