February 2019
Intermediate to advanced
450 pages
11h 59m
English
Did you notice that, in our hello world example, the Quit button would exit the application, but that closing the window did not? That's because we didn't connect any callback to the window destroy signal. We can fix this by adding the following lines to handle this case:
window.Connect("destroy", func() { gtk.MainQuit()})
This code connects the provided anonymous function to the destroy signal of window. When the signal is emitted, the function is called and the application will now exit correctly. As the gtk.MainQuit() function takes 0 parameters, we could write the same more concisely as follows:
window.Connect("destroy", gtk.MainQuit)
But hold on a moment, how come the button click worked? That's because we used the Clicked() ...
Read now
Unlock full access