Re: [Vala] Builer connect signals



John - wrote:
I have this code :

    public class TestWindow : GLib.Object
    {

        public TestWindow ()
        {
            Builder builder = new Builder();
            
            try
            {
                builder.add_from_file ("test.ui");
            }
            catch (Error exc) 
            {
                
            }
            
            builder.connect_signals (this);
            
        }
        
        [CCode (instance_pos = -1)]
        public void on_testButton_activate(Button sender)
        {
           //some code
        }

    }

I create a GtkBuilder project file for gtk 2.16 with glade2.

The signal code doesn't work, it loads test window with button but code for signal activate doesn't run.

Did you specify the right callback name in Glade? It must be
'test_window_on_testButton_activate', or if it's inside a namespace
'namespace_name_test_window_on_testButton_activate'. Or are you on
Windows? In this case you would have to add G_MODULE_EXPORT.


Best regards,

Frederik



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