[gtkada] focus-in events for a group of widgets

Stephen Leake stephen_leake at acm.org
Tue Aug 24 04:07:09 CEST 2004


Stephen Leake <stephen_leake at acm.org> writes:

> "Manuel Op de Coul" <manuel.op.de.coul at eon-benelux.com> writes:
> 
> > >I've got an application where I'd like to handle the focus-in event
> > >for a group of widgets in a Hbox. The Hbox represents a record; each
> > >contained widget edits a field in the record. There are several
> > >records displayed at once.
> > 
> > Sounds like a table may be a better choice.
> 
> That's probably true. I'm porting this application from Windex (my own
> binding to Win32), where I didn't have tables.
> 
> > I'd keep an array of all the entry widgets you have, and test which
> > one has the focus, I think Gtk.Widget.Has_Focus_Is_Set can be used.
> > Then no focus-in event handler is needed.
> 
> Hmm. I'm trying to avoid enumerating all the focusable widgets. But if
> I can't avoid that, perhaps testing who has the focus is better than
> handling lots of focus events. Thanks for the suggestion.

On second thought, this won't work. I need to know which record had
the focus, _after_ the user clicks the button that does something with
that record. At that point, the button has the focus.

Someone else suggested wrapping the hbox in a GtkEvent window; it
seems widgets that are not derived from Gtk.Window can't get events
(although they can get signals). But that didn't work either;
apparently GtkEvent widgets don't get focus-in-event.

-- 
-- Stephe




More information about the gtkada mailing list