[Glade-users] button signals



On Tue, 2003-05-13 at 06:35, GCS wrote:
On Mon, 2003-05-12 at 11:00, GCS wrote:
I get gtk_signal_connect_swapped call to the handler function.
How can I force this to be the gtk_signal_connect call? As I would like
to pass data to the handler function.

gtk_signal_connect_swapped() is output if you specify an object.
If you leave the 'Object:' field blank it will probably do what you want.

 I misunderstand something then. I have read part of the tutorial, which
said if I do not pass an object, then I get gtk_signal_connect_swapped(),
and gtk_signal_connect if I specify one. I think I am seriously wrong.
Let me ask it in an other way: with Glade-2, I create a dialog window
from the predefined set. I set up the cancel button to emmit the clicked
signal, and send the dialog widget as an object. Thus in the handler
function I can call gtk_widget_destroy(user_data), to close the dialog
window. It does not work for me, it closes the cancel button itself,
not the dialog. If I delete the _swapped ending from the signal setup,
it is working. What do I miss in this case?

The standard way to connect a handler for a signal is:

   g_signal_connect (button, "clicked", on_button_clicked, user_data);

on_button_clicked() will then be called with button as the first argument.



However, if you want another object to be the first argument, you set the
'Object:' field in Glade. Then g_signal_connect_swapped() will be output,
and the object will be the first argument to the handler function.

Basically the 'Object:' field is too confusing so just avoid it.

Damon






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