Re: Set focus



Johnny wrote:
Hi, I'm using an application with gtk1.2. How can I set the focus to a widget?

I think its:
http://developer.gnome.org/doc/API/gtk/gtkwidget.html#GTK-WIDGET-GRAB-FOCUS

I've another question, in my interface I've used a GtkSheet, I can't use
TAB,PAGE UP or PAGE DOWN button because they are already used by the GtkSheet,
how can I use them?

GtkSheet is from gtkextra.sf.net ?

You can do a number of things,

This will allow you to "snoop" all incoming key press events application wide:
http://developer.gnome.org/doc/API/gtk/gtk-general.html#GTK-KEY-SNOOPER-INSTALL

Now, usualy you can hook on to this signal:
http://developer.gnome.org/doc/API/gtk/gtkwidget.html#GTKWIDGET-KEY-PRESS-EVENT

gtk_signal_connect(GTK_WIDGET(sheet), handler, data);


boolean hander (GtkWidget *sheet, GdkEventKey event, gpointer user_data)
{
    // if you return FALSE here, this signal will propogate to the handler
    // defined by the GtkSheetClass, otherwise, the signal should be "dropped"
    // but I'm not sure what the event order is in GTK 1.2, maybe the GtkSheet
    // will have its signal handler called first in which case you are screwed,
    // but that should not be.
    return FALSE;
}

Regards,
                                            -Tristan




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