Open emersion opened 8 years ago
uiForm does not have a concept of submitting, because it is purely a layout container.
What you are describing would be done with the "default button" of a dialog. When I add custom dialogs, you will be able to do exactly this, and with any layout container.
Custom dialogs sound awesome! You see them a lot in GTK and macOS. Do you have any sort of ETA on those?
No, because dialogs are held up by OSs being highly incompatibly different with issues of modality. I don't know how to solve it, and explaining it will be more complex than explaining the menu issue.
I'm looking at some tangentially dialog-related issues at the moment, so I'll add my notes here for future reference:
On Gtk, there's GtkDialog:
activates-default
boolean property to set this behavour). Not sure about other widget types.response
signal when a dialog button (in the bottom area) is activated.close
signal when the dialog is closed (eg, by pressing escape).Seems quite nice and simple, and easy to understand. At first glance, anyway ;-) If libui could have a model along these lines I'd be pretty happy, but need to see what windows and osx do.
I think the NSPanel window subclass is the OSX equivalent:
Windows Dialog Box reference
Looks like on windows you can, in fact, subclass the Dialog Box and create the layout yourself without faffing about with a dialog template.
GTK+: you do not have to follow the standard widget layout for dialog boxes. You don't even have to use GtkDialog as GtkWindow already has all the relevant properties in it, but I forget if there are any edge cases that make this not-ideal.
Windows: you do not have to use the dialog template system at all. In fact, you don't even have to use WC_DIALOG
; Raymond Chen has a series of articles in which you recreate the functionality of the DialogBox()
function!
The platform-incompatible issues I mentioned are much more subtle than anything you listed here. I can talk about them in more detail later.
Right now pressing the Enter key when typing in a
uiForm
does nothing. It should submit the form.One solution would be to add a
uiFormOnSubmitted
function that calls the callback when Enter is pressed in the form'suiEntry
childs. AuiFormSubmit
function can be added to submit the form when clicking a button.Thoughts?