[Gtk-sharp-list] Menu quit handler

Baltasar García Perez-Schofield baltasarq at gmail.com
Sun Feb 12 10:01:35 UTC 2017


Hi, Sascha,

Mmmm... that's not the signature for MenuItem's activation... your signal
handler seems to be more related to window deletion than to a menu item
activation.

Take a look here:
http://zetcode.com/gui/gtksharp/menus/

And here:
http://zetcode.com/gui/gtksharp/firststeps/

In short, your method should be:
==
protected void OnMenuQuitActivate(object sender, EventArgs a) {
    Application.Quit();
}
==

Hope this helps,
-- Baltasar



El vie., 10 feb. 2017 a las 14:01, Sascha Manns (<Sascha.Manns at mailbox.org>)
escribió:

> Hello list,
>
> i have defined a menu item "File/Quit" like so:
>
> <object class="GtkMenuItem">
>   <property name="visible">True</property>
>   <property name="can_focus">False</property>
>   <property name="label" translatable="yes">_Datei</property>
>   <property name="use_underline">True</property>
>   <child type="submenu">
>     <object class="GtkMenu">
>       <property name="visible">True</property>
>       <property name="can_focus">False</property>
>       <child>
>         <object class="GtkImageMenuItem" id="menuQuit">
>           <property name="label">gtk-quit</property>
>           <property name="name">menuQuit</property>
>           <property name="visible">True</property>
>           <property name="can_focus">False</property>
>           <property name="use_underline">True</property>
>           <property name="use_stock">True</property>
>           <signal name="activate" handler="OnMenuQuitActivate" swapped="no"/>
>         </object>
>       </child>
>     </object>
>   </child>
> </object>
>
>
> How must be the "OnMenuQuitActivate" handler looks like, that it quits the
> application?
>
> I tried out:
>
> protected void OnMenuQuitActivate(object sender, DeleteEventArgs a) {
>     Application.Quit();
>     a.RetVal = true;
> }
>
>
> But that doesn't work.
>
> Greetings
> Sascha
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.dot.net
> http://lists.dot.net/mailman/listinfo/gtk-sharp-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/gtk-sharp-list/attachments/20170212/25ca6e1e/attachment.html>


More information about the Gtk-sharp-list mailing list