Re: Auto-scroll -- more questions of my own



"Edward A. Falk" <falk efalk org> writes:

Hey; since we're on the subject, I have two more questions about
scrolling:

I have a form the user is filling out, sort of like a spreadsheet.

      http://www.efalk.org/xplan2.gif

As you can see, I have a table containing dozens of text entry widgets.
The table is packed into a scrolled window.

How can I (a) allow the page up/down/home/end keys scroll the scrolled
window, even when one of the text entry widgets inside it has focus, and

Page Up, Page Down should just work with GTK+-2.0. I don't think
overriding the GTK+ order and making Home/End move the scrolled
window instead of the cursor is a good idea, but if you really
need to achieve the effect, connecting to ::key_press_event on
the entry and returning TRUE for the keys you want to pass up
to the entry should work.

(b) how can I *automatically* scroll the window to make sure that the text
entry widget with focus is always visible?

Something like:

     gtk_container_set_focus_hadjustment (GTK_CONTAINER (table),
                                           gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW 
(scrolled_window)));
      gtk_container_set_focus_vadjustment (GTK_CONTAINER (table),
                                           gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW 
(scrolled_window)));

Should do it. (Don't ask why this magic is necessary. It should
be done automatically, but isn't. it's probably never been fixed
because UI-wise, scrolled windows with widgets inside them are
generally not a great idea.)

Regards,
                                        Owen




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