Re: focus questions
- From: Mark Leisher <mleisher crl nmsu edu>
- To: gtk-app-devel-list gnome org
- Subject: Re: focus questions
- Date: Fri, 22 Dec 2000 08:48:34 -0700 (MST)
Pavel> 1. GTK_WIDGET_SET_FLAGS (myDrawingArea, GTK_CAN_FOCUS);
Pavel> 2. gtk_widget_grab_focus(myDrawingArea);
Pavel> 3. gtk_signal_connect(GTK_OBJECT(myDrawingArea), "key_press_event",
Pavel> GTK_SIGNAL_FUNC(myOnKeyPress), this);
True.
Pavel> However, this raises a few questions in my mind. a. Is it correct
Pavel> to think that only one widget *per window* has focus at one time?
Pavel> b. If the window loses focus and gets it back, the same child
Pavel> widget will have focus? c. The command 2. will generate a focus_in
Pavel> event? d. Is this bad design? Is it better to have the window
Pavel> capture the key_events and somehow redistribute them?
The mouse pointer leaving and entering a window generally does not change
focus, it simply causes enter_notify_event and leave_notify_event signals.
In your "myOnKeyPress" signal handler, if you use a keypress, return TRUE to
indicate it was used. Otherwise return FALSE so it can be passed along to any
other object that might need it.
Pavel> I know I could experiment but it's so much easier to ask (and the
Pavel> respondent usually go outside the question, too :)
The easy questions will get answers, the hard ones won't. Once you are more
familiar with GTK, you will find you have to experiment to get answers :-)
-----------------------------------------------------------------------------
Mark Leisher
Computing Research Lab Cinema, radio, television, magazines are a
New Mexico State University school of inattention: people look without
Box 30001, Dept. 3CRL seeing, listen without hearing.
Las Cruces, NM 88003 -- Robert Bresson
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]