PDA

View Full Version : [SOLVED] GtkWidget "property"



Milliways
December 25th, 2009, 09:07 AM
How does one get the "has_focus" property?

OgreProgrammer
December 25th, 2009, 09:48 AM
Click on it I believe.

nvteighen
December 25th, 2009, 02:16 PM
What do you mean? Getting the "has_focus" status? Use gtk_widget_has_focus(GtkWidget *) (this is in the original GTK+ C library).

Milliways
December 26th, 2009, 12:25 AM
What do you mean? Getting the "has_focus" status? Use gtk_widget_has_focus(GtkWidget *) (this is in the original GTK+ C library).

I found this macro definition:-

#define GTK_WIDGET_HAS_FOCUS(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_FOCUS) != 0)

The GtkWidget lists a number of Properties, one of which is the "has-focus" property, but does not seem to explain how to use these properties.

"has-focus" gboolean : Read / Write
Whether the widget has the input focus.


It is possible that the GTK_WIDGET_HAS_FOCUS macro is the implementation, but what about the "name" property

"name" gchar* : Read / Write
The name of the widget.

napsy
December 26th, 2009, 10:52 AM
Or you could use


g_object_get_property ()


To get the property you want but it's easier to use the convenience function already mentioned (eg. GTK_WIDGET_HAS_FOCUS()).

nvteighen
December 26th, 2009, 10:54 AM
I found this macro definition:-

#define GTK_WIDGET_HAS_FOCUS(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_FOCUS) != 0)

The GtkWidget lists a number of Properties, one of which is the "has-focus" property, but does not seem to explain how to use these properties.

"has-focus" gboolean : Read / Write
Whether the widget has the input focus.


It is possible that the GTK_WIDGET_HAS_FOCUS macro is the implementation, but what about the "name" property

"name" gchar* : Read / Write
The name of the widget.

No, I mean the gtk_widget_has_focus() function, not the macro definition. http://library.gnome.org/devel/gtk/stable/GtkWidget.html#gtk-widget-has-focus

Milliways
December 26th, 2009, 01:03 PM
No, I mean the gtk_widget_has_focus() function, not the macro definition. http://library.gnome.org/devel/gtk/stable/GtkWidget.html#gtk-widget-has-focus

This says "Since 2.18" I am using GTK+ 2.16.1 (download for Ubuntu 9.04)

Thanks for the responses.