What is the proper way to do a non-modal dialog
in gtk2hs? My attempt was:
. Create a dialog (using, say, fileChooserDialogNew).
. Connect a callback to receive events, where I do
the proper action with ResponseAccept.
. Write a button callback to widgetShowAll my dialog
when the button is pressed.
But, after I show my dialog, if a give it a ESC key
it is destroyed, and an attempt to widgetShowAll
again is invalid. Also, cancel button do not hide
the dialog (although I could use my callback to do
that, if it's the proper way to do).
Wednesday, January 21, 2009, 3:26:36 PM, you wrote:
> What is the proper way to do a non-modal dialog
> in gtk2hs? My attempt was:
window <- windowNew
backgroundButton <- buttonNewWithMnemonic "Background"
pauseButton <- toggleButtonNewWithMnemonic "Pause"
cancelButton <- buttonNewWithMnemonic "Cancel"
window `onDelete` \e -> do
cancelButton `onClicked` do
pauseButton `onToggled` do
backgroundButton `onClicked` do
>> What is the proper way to do a non-modal dialog
>> in gtk2hs? My attempt was:
> window <- windowNew
Got it. From gtk documentation, the "standard" way
to go is to handle the 'delete-event' event with
a convenience function, gtk_widget_hide_on_delete.
Gtk2hs do not expose that function, but all it
does is (widgetHide widName >> return True).
To show the dialog, widgetShowAll. To respond to
buttons, set onResponse to a ResponseId handler.
Get latest updates about Open Source Projects, Conferences and News.