Re: [gtk-list] Re: compiling problem...
- From: Owen Taylor <owt1 cornell edu>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: compiling problem...
- Date: Mon, 08 Dec 1997 19:51:24 -0500
> Why does a gtk_list not emit any focus_in/out signals? I didn't look at the
> code (gtk oct. 97), but I tried to catch all focus_in signals. It works
> with buttons and checkboxes, but not with lists.
As a preface, I should say that there are currently some problems with
focus handling. I'll probably have some changes in this area as part
of the embedded window widget I'm writing now - so things may change.
And keyboard handling in lists is a sticky area as well.
(though it has been improved recently)
Lists don't get focus_in/out signals because they don't get the
focus themselves. Focus events are sent when a widget gets the
focus or loses the focus.
(This is not the whole truth - focus events are also occur when an
X Focus event is received - in a manner that makes it impossible
to know why the event was sent - but this, normally, only matters
for toplevel windows)
If you set the CAN_FOCUS flag on a list:
GTK_WIDGET_SET_FLAGS (list, GTK_CAN_FOCUS)
then the list will get the focus, but the child listitems
won't - which may or may not be what you want.
> If I want to create my own widget, that is supposed to be dialog item,
> what do I have to do, in order to make it possible to select/focus it
> using tabs?
Like most questions about widget creation, the best answer is
to look at an existing widget. In this case, the Button widget is
probably a good example.
You basically need to:
* call GTK_WIDGET_SET_FLAGS (button, GTK_CAN_FOCUS) in the _init() routine.
* Provide handlers for the "focus_in_event" and "focus_out_event"
* signals. (You can probably copy these pretty much verbatim from the
Button widget)
* Provide a handler for "draw_focus" that (It typically draws a thin
black box around the widget.)
> How can I do a (partial) refresh of a window, i.e. I want to redraw
> only a part (rectangle) of a window?
gtk_widget_draw (widget, &rect);
> I must have missed the obvious, but I found 6 or so functions, which
> return the length of a string (in pixels given a certain font). How about
> a string's height?
font->ascent + font->descent.
Feel free to ask further if the above isn't clear. Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]