Fwd: Keep dialogs open and running even if clicking OK
- From: Lex Trotman <elextr gmail com>
- To: gtk-list <gtk-list gnome org>
- Subject: Fwd: Keep dialogs open and running even if clicking OK
- Date: Fri, 8 Apr 2011 21:51:10 +1000
Why doesn't gtk list headers have reply to the list like all the
others I subscribe to, grumble grumble :(
---------- Forwarded message ----------
From: Lex Trotman <elextr gmail com>
Date: 8 April 2011 21:41
Subject: Re: Keep dialogs open and running even if clicking OK
To: Paul Everlund <paul everlund axis com>
[...]
> Some pseudo/real-code maybe describes it better:
>
> class MainApp
> def initialize()
> @glade = GladeXML.new(bla, bla, bla) {|handler| method(handler)}
> end
>
> def on_menuUserPassword_activate(widget)
> gUP = UserPasswordDlgGlade.new()
> dlg = gUP.get_widget("UPDlg")
> dlg.show()
> result = dlg.run()
Suggest you do the validation here and if it fails, show the fail
message then loop back to dlg.run to give them another go, note you
haven't hidden the dialog yet so the user won't see any change.
Go on to hide and destroy the dialog when the UP is correct or give up.
> dlg.hide()
> end
> end
>
> // Get the main app up and running.
> MainApp.new()
> Gtk.main
>
> class UserPasswordDlgGlade
> def initialize()
> @glade = GladeXML.new(bla, bla, bla) {|handler| method(handler)}
> end
>
> def on_btnApply_clicked(widget)
> Get the user and password from the widget entries
> If user and password were not valid
do this in main
> gMsg = MessageDlgGlade.new()
> dlg = gMsg.get_widget("MsgDlg")
> dlg.show()
> dlg.run()
> dlg.close()
> If here the user clicked the message dialog's OK button, and we should disregard the Apply click on this UPDlg, and let the user correct the input.
> else
> The user and password was correct, so now we should actually return the Apply response code to the MainApp.
> end
> end
>
> def on_UPDlg_delete_event(a, b, c)
> Here was where I tried to keep the UPDlg still running, by returning either TRUE or FALSE, but it never seemed to enter this function, even though I connected this signal in Glade.
> end
> end
As documented, delete isn't emitted on dialogs:
"If a dialog receives a delete event, the "response" signal will be
emitted with a response ID of GTK_RESPONSE_DELETE_EVENT. "
Cheers
Lex
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]