Fwd: Keep dialogs open and running even if clicking OK

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

 



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@xxxxxxxxx>
Date: 8 April 2011 21:41
Subject: Re: Keep dialogs open and running even if clicking OK
To: Paul Everlund <paul.everlund@xxxxxxxx>


[...]
> 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
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list



[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux