Re: GTK Action Handler



Tadej BorovÅak wrote:
Hello.

When the button or expander is clicked with the mouse the callbacks work
fine.  The problem is from the menu the "activate" signal has GtkAction
as the first parameter of the callback and I don't think that can be
cast to a GtkButton or GtkExpander.  I want to call the button and
expander callbacks as if they were clicked with the mouse.

You can get hold of the proxy widget of the action by calling
gtk_action_get_proxies(). After you obtain the needed widget, you cna
call callback function like it would be called by GTK+ itself.

Tadej


I tried gtk_action_get_proxies() which works, but it looks like it
returns the menu item.  I'm still not sure how everything ties together.
 For example why is the function called gtk_action_get_proxies() it
seems to just return the menu item.  Anyway the way I got it to work,
which doesn't seem unreasonable, was to traverse the GtkWindow down
until I found the GtkExpander in that I was looking for and then I
emitted a signal.  I think this is what you were getting at.  So now my
callback for the action handler is a wrapper around
g_signal_emit_by_name(G_OBJECT(xpndr), "activate").  It finds the
expander and emits the signal.

Any idea how I can connect an accelerator to the Tab key?  In the
gtk_accelerator_name() function in the gtkaccelgroup.c file there isn't
a "<Tab>" in the list of accelerator name; however, I think there's a
way to add one, possibly with gtk_accel_group_connect(), but I'm not sure.


Thanks,
dhk





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