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

Re: 2 quick questions: CList and Text




On Fri, 25 Jun 1999, Mike Clark wrote:
> first, i would like to know if there is a way that a particular row
> within a CList can grab focus. i would like to be able to do a
> gtk_clist_select_row() on any particular row and also have that row grab
> keyboard focus so that pressing the up and down arrow keys will move
> from that row.. right now it will only move from the first row in the
> clist.
>

Well, as you've probably noticed the focus does move if the user clicks
the mouse to select a row. The code that does that, from clist's button
press handler:

 if (row != clist->focus_row)
                {
                  if (GTK_WIDGET_HAS_FOCUS(widget))
                    {
                      gtk_clist_draw_focus (widget);
                      clist->focus_row = row;
                      gtk_clist_draw_focus (widget);
                    }
                  else
                    clist->focus_row = row;
                }

I think it would certainly work to do this, but it is relying on the
widget's internals so you wouldn't be able to complain if it broke in
future Gtk versions. 

However, I see no way to do it using the exported API. Probably a patch to
export the API, or perhaps to make gtk_clist_select_row() also move the
focus, would be a reasonable thing for Gtk 1.4 if you want to submit such
a patch. 

Oh, gtk_clist_draw_focus isn't exported so you'd need to use
gtk_widget_draw_focus() instead. That should end up invoking
gtk_clist_draw_focus.

> second, i want to have a GtkText item that will scroll both horizontally
> and vertically. i am putting it inside a GtkScrolledWindow, but it will
> only scroll vertically. the text will wrap instead of scrolling
> horizontaly.

You're doomed here - GtkText sucks, and one of the ways in which it sucks
is that it doesn't scroll horizontally. It's supposed to be rewritten for
1.4, FWIW.

Havoc




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