strange focus behaviour



Hi!

I am using
gtk2 0.96, glib2 0.96, gtk2::gladexml 0.90

I have a window designed with glade-2, and parsed with gladexml. In the
window there are three focusable (CAN_FOCUS) widget, (entry1, entry2,
ok)

If I press Tab, the focus (in order) is: entry1 -> entry2 -> ok

When I start my app, before the main Gtk2 I do a $entry1->grab_focus
call, but somehow when the window shows up, the focus is on entry2.

I examined the problem, I commented the grab_focus line out, and tried
to set this property in glade (HAS_FOCUS), but it didn't had any
meaning. (I still had to press 'Tab' to focus entry1), so I uncommented
the grab_focus line.

After this I attached a callback funtion on entry1's 'focus' signal. The
callback function was sub {1}. This way the focus stayed on entry1, but
thereafter I could not focus entry2 with pressing the 'Tab'.

I attached a debugger callback, to entry1, and entry2-s 'focus_in',
'focus_out','grab_focus; signlals:

entry1 focus_in
entry2 grab_focus
main Gtk
entry1 focus_out
entry2 focus_in
entry2 grab_focus

My workaround: Instead of the $entry1->grab_focus I wrote
$ok->grab_focus! It works well, but I think this is not the way it
should be. Probably somewhere the 'focus' signal's default callback
does something wrong...

-- 
doome




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]