I tried to handle events from .ui file with add_callback_symbol
in vala but I get this error
error: Argument 2: Cannot convert from `void on_button2_clicked (Gtk.Button)' to `void GLib.Callback ()'
builder.add_callback_symbol ("on_button2_clicked", on_button2_clicked);
^^^^^^^^^^^^^^^^^^
this is event in .ui file
<object class="GtkButton" id="button2">
<property name="label">Button 2</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
<signal name="clicked" handler="on_button2_clicked" swapped="no"/>
</object>
and this is handle code
// out main
public void on_button2_clicked (Button source) {
source.label = "Thanks!";
}
// in main
var builder = new Builder ();
builder.add_from_resource ("/me/rush/Rush/main.ui");
builder.add_callback_symbol ("on_button2_clicked", on_button2_clicked);
I tried to use function as lambda expression in place of callback it compile successfully but no thing work, also I cant pass parameters in this way (if I pass error appear)
so please if anyone know help me, coz I tried also connect_signals
from this example but also it doesnt work with me, its appear error tell me to use -rdynamic when compiling from searching for this error mean I need to use gmoudle and it need editing when I compile for windows (I use debian), so I think it easiet to know how to do it with add_callback_symbol
or add_callback_symbols