FLTK logo

Re: [fltk/fltk] fl_choice() doesn't tell you if the dialog was closed (#282)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: [fltk/fltk] fl_choice() doesn't tell you if the dialog was closed (#282) Albrecht Schlosser Oct 14, 2021  
 

Would it help to add a function like fl_message_window_closed() that would return 1 if the last dialog (fl_ask, fl_choice, etc.) was closed w/o pressing a button (or using its shortcut), i.e. by Escape or the window close button? User code would then look like:

  int ret = fl_choice(...);
  if ( /* ret == 0 && */ fl_message_window_closed())
    ret = -1;

You could put that in your own fl_choice() wrapper or use it whenever you need it. I don't think you need the "ret == 0 &&" part but I added it above for clarity.

I also thought about making it possible to assign a callback for [ the next call of ] a standard dialog which would get the window close event (by Escape or window close button) but that seems to be more complicated (a) for the user to set up and (b) for the internal implementation. Or maybe not.

Thoughts, other ideas?

PS: In the future I'd like to get away from these static dialog windows and functions. We need a proper dialog class that can be called by the user or conveniency functions like fl_choice() etc. and can have multiple instances at a time [1]. This new dialog class could take care of this. But that's not yet available.

[1] Multiple instances can be necessary if such a dialog is triggered by a timeout while another dialog is still open. See also STR 3242: Re-enable nested (aka "recursive") common dialogs. The title is somewhat misleading, it's more about parallel than nested dialogs.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.