(Gtk) Interface designed with GLADE, the registered function for button click event is not being called

I am using GLADE to develop an interface that gets built afterwards by Gtk.jl, and the interface layout appears with all of the labels and buttons after it is built in my Julia code. Within GLADE, for the the ‘button’ object the ‘signals’ table for the button has a ‘handler’ set for the ‘clicked’ event to be the name of a function I have written. This function handler is written in the same file which launches the window built from GtkBuilder with the appropriate name, and this function handler has a println statement to check if it is being pressed, but no event or function call appears to be happening although the button focus appears to be producing an event signal. The code for the MWE;

using Gtk
b = GtkBuilder(filename="try1.glade")
win=b["welcomeWindow"]
function simple(Widget)
    println("welcomeButton_clicked")
end      
showall(win)

the XML file of the GLADE output that I am building from does contain the function name simple I provided

<property name="name">welcomeButton</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <signal name="clicked" handler="simple" swapped="no"/>
          </object>

The key from what I understand is the signal name="clicked" handler="simple" swapped="no"/> and that should be picked up from function simple(Widget) unless I am mistaken in something.

using Gtk


function main()
    b = GtkBuilder(filename="try1.glade")
    win=b["mainWindow"]
    
    button=b["mainWindowButton"]
    signal_connect(simple,button,"clicked")
    
   showall(win)
end

function simple(Widget)
    println("clicked")
end

main()
3 Likes