Re: ZvtWidget and Focus Problem
- From: Tristan Van Berkom <vantr touchtunes com>
- To: O-Zone <o-zone zerozone it>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: ZvtWidget and Focus Problem
- Date: Tue, 13 May 2003 09:41:06 -0400
I wrote this little handy function to help when I wasn't sure
what flags were set or not etc... it might turn out usefull to you.
I forget what exaxtly the api was but a wild guess tells me you
need something like:
GTK_WIDGET_SET_FLAGS(GTK_WIDGET(zvt),
current_flags | GTK_WIDGET_CAN_FOCUS);
Cheers,
-Tristan
/* function to print all kinds of widget flags in a readable format
follows */
#define
GTK_WIDGET_STATE_STR(wid)
\
GTK_WIDGET_STATE(wid) == GTK_STATE_NORMAL ? "GTK_STATE_NORMAL"
: \
GTK_WIDGET_STATE(wid) == GTK_STATE_ACTIVE ? "GTK_STATE_ACTIVE"
: \
GTK_WIDGET_STATE(wid) == GTK_STATE_PRELIGHT ? "GTK_STATE_PRELIGHT"
: \
GTK_WIDGET_STATE(wid) == GTK_STATE_SELECTED ? "GTK_STATE_SELECTED"
: \
GTK_WIDGET_STATE(wid) == GTK_STATE_INSENSITIVE ?
"GTK_STATE_INSENSITIVE" : "UNKNOWN"
#define GTK_WIDGET_TOPLEVEL_STR(wid) \
GTK_WIDGET_TOPLEVEL(wid) ? "TRUE" : "FALSE"
#define GTK_WIDGET_NO_WINDOW_STR(wid) \
GTK_WIDGET_NO_WINDOW(wid) ? "TRUE" : "FALSE"
#define GTK_WIDGET_REALIZED_STR(wid) \
GTK_WIDGET_REALIZED(wid) ? "TRUE" : "FALSE"
#define GTK_WIDGET_MAPPED_STR(wid) \
GTK_WIDGET_MAPPED(wid) ? "TRUE" : "FALSE"
#define GTK_WIDGET_VISIBLE_STR(wid) \
GTK_WIDGET_VISIBLE(wid) ? "TRUE" : "FALSE"
#define GTK_WIDGET_DRAWABLE_STR(wid) \
GTK_WIDGET_DRAWABLE(wid) ? "TRUE" : "FALSE"
#define GTK_WIDGET_SENSITIVE_STR(wid) \
GTK_WIDGET_SENSITIVE(wid) ? "TRUE" : "FALSE"
#define GTK_WIDGET_PARENT_SENSITIVE_STR(wid) \
GTK_WIDGET_PARENT_SENSITIVE(wid) ? "TRUE" : "FALSE"
#define GTK_WIDGET_CAN_FOCUS_STR(wid) \
GTK_WIDGET_CAN_FOCUS(wid) ? "TRUE" : "FALSE"
#define GTK_WIDGET_HAS_FOCUS_STR(wid) \
GTK_WIDGET_HAS_FOCUS(wid) ? "TRUE" : "FALSE"
#define GTK_WIDGET_CAN_DEFAULT_STR(wid) \
GTK_WIDGET_CAN_DEFAULT(wid) ? "TRUE" : "FALSE"
#define GTK_WIDGET_RECEIVES_DEFAULT_STR(wid) \
GTK_WIDGET_RECEIVES_DEFAULT(wid) ? "TRUE" : "FALSE"
#define GTK_WIDGET_HAS_DEFAULT_STR(wid) \
GTK_WIDGET_HAS_DEFAULT(wid) ? "TRUE" : "FALSE"
#define GTK_WIDGET_HAS_GRAB_STR(wid) \
GTK_WIDGET_HAS_GRAB(wid) ? "TRUE" : "FALSE"
#define GTK_WIDGET_RC_STYLE_STR(wid) \
GTK_WIDGET_RC_STYLE(wid) ? "TRUE" : "FALSE"
#define GTK_WIDGET_COMPOSITE_CHILD_STR(wid) \
GTK_WIDGET_COMPOSITE_CHILD(wid) ? "TRUE" : "FALSE"
#define GTK_WIDGET_APP_PAINTABLE_STR(wid) \
GTK_WIDGET_APP_PAINTABLE(wid) ? "TRUE" : "FALSE"
#define GTK_WIDGET_DOUBLE_BUFFERED_STR(wid) \
GTK_WIDGET_DOUBLE_BUFFERED(wid) ? "TRUE" : "FALSE"
void gtk_widget_debug(GtkWidget *wid);
void gtk_widget_debug(GtkWidget *wid) {
if (GTK_IS_WIDGET(wid)) {
g_message("Printing widget info for %s\n\t"
"Widget state: %s\n\t"
"Top Level: %s\n\t"
"No Window: %s\n\t"
"Realized: %s\n\t"
"Mapped: %s\n\t"
"Visible: %s\n\t"
"Drawable: %s\n\t"
"Sensitive: %s\n\t"
"Parent Sensative: %s\n\t"
"Can Focus: %s\n\t"
"Has Focus: %s\n\t"
"Can Default: %s\n\t"
"Recieves Default: %s\n\t"
"Has Defualt: %s\n\t"
"Has Grab: %s\n\t"
"Rc Style: %s\n\t"
"Composite Child: %s\n\t"
"App Paintable: %s\n\t"
"Double Buffered: %s\n",
gtk_widget_get_name(GTK_WIDGET(wid)),
GTK_WIDGET_STATE_STR(GTK_WIDGET(wid)),
GTK_WIDGET_TOPLEVEL_STR(GTK_WIDGET(wid)),
GTK_WIDGET_NO_WINDOW_STR(GTK_WIDGET(wid)),
GTK_WIDGET_REALIZED_STR(GTK_WIDGET(wid)),
GTK_WIDGET_MAPPED_STR(GTK_WIDGET(wid)),
GTK_WIDGET_VISIBLE_STR(GTK_WIDGET(wid)),
GTK_WIDGET_DRAWABLE_STR(GTK_WIDGET(wid)),
GTK_WIDGET_SENSITIVE_STR(GTK_WIDGET(wid)),
GTK_WIDGET_PARENT_SENSITIVE_STR(GTK_WIDGET(wid)),
GTK_WIDGET_CAN_FOCUS_STR(GTK_WIDGET(wid)),
GTK_WIDGET_HAS_FOCUS_STR(GTK_WIDGET(wid)),
GTK_WIDGET_CAN_DEFAULT_STR(GTK_WIDGET(wid)),
GTK_WIDGET_RECEIVES_DEFAULT_STR(GTK_WIDGET(wid)),
GTK_WIDGET_HAS_DEFAULT_STR(GTK_WIDGET(wid)),
GTK_WIDGET_HAS_GRAB_STR(GTK_WIDGET(wid)),
GTK_WIDGET_RC_STYLE_STR(GTK_WIDGET(wid)),
GTK_WIDGET_COMPOSITE_CHILD_STR(GTK_WIDGET(wid)),
GTK_WIDGET_APP_PAINTABLE_STR(GTK_WIDGET(wid)),
GTK_WIDGET_DOUBLE_BUFFERED_STR(GTK_WIDGET(wid)));
} else {
g_message(__FUNCTION__ ": Argument is not a widget");
}
}
O-Zone wrote:
Hi all,
i've embedded a ZvtWidget (Zed Virtual Terminal) into an application (OzEDITor
http://ozeditor.zerozone.it) and i've a problem, perhaps with focus. This
widget doesn't work if is not focused (ok) but it NEVER GET FOCUSED !!! If i
click on it it doesn't get focused...why ?
Oz
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]