Re: [gtk-list] Re: Clist within scrolled window
- From: Kent Schumacher <kent structural-wood com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Clist within scrolled window
- Date: Mon, 25 Oct 1999 09:30:48 -0500
Federico Mena Quintero wrote:
> > I have a clist within a scrolled window, and I select a row by
> > gtk_clist_select_row. My question: is it possible to scroll
> > by some gtk+ call the scrolled window so that the selected row of
> > the clist appears at the top of the scrolled window?
>
> You can use gtk_clist_moveto() to do that.
>
> Federico
>
I agree that this is the proper function but I have never been able to
get it to work. A quick guess at the problem is that the function
adjust_adjustments() overrides the value that is set in move_vertical().
A similiar question was asked last May
> Michael J. Hammel (mjhammel@graphics-muse.org)
> Fri, 28 May 1999 00:46:10 -0600 (MDT)
>
> I've got a Clist inside a scrolled window. I want to tell the scrolled
> window to have the currently selected list item visible when the window
> opens. Currently, I do this:
>
> formats_viewport = gtk_scrolled_window_new(NULL, NULL);
> gtk_scrolled_window_set_policy (
> GTK_SCROLLED_WINDOW (formats_viewport),
> GTK_POLICY_AUTOMATIC,
> GTK_POLICY_AUTOMATIC);
> gtk_box_pack_start (GTK_BOX (vbox), formats_viewport, TRUE, TRUE, 0);
> gtk_widget_show (formats_viewport);
>
> formats_list = gtk_clist_new(1);
> gtk_scrolled_window_add_with_viewport
> (GTK_SCROLLED_WINDOW (formats_viewport), formats_list);
> gtk_widget_show (formats_list);
> gtk_clist_set_selection_mode (GTK_CLIST (formats_list), GTK_SELECTION_BROWSE);
> gtk_container_set_focus_vadjustment (GTK_CONTAINER (formats_list),
> gtk_scrolled_window_get_vadjustment
> (GTK_SCROLLED_WINDOW (formats_viewport)));
>
> gtk_clist_select_row(GTK_CLIST(formats_list), saved_item, 0);
>
> where saved_item is the entry in the list I want to display. I've also
> tried adding gtk_clist_moveto(), but that didn't seem to help. I've also
> tried calling gtk_adjustment_changed() for the list widget. Again, that
> seemed to make no difference.
>
> How can I force the selected item to be visible in the scrolled list when
> the window opens?
>
> Note: I couldn't get either GtkList nor GtkClist to do this. Both will
> select the item, but neither seems to allow me to scroll to that item. I
> suspect it has something to do with adjustments, but I just don't know what
> piece I'm missing.
> --
> Michael J. Hammel |
> The Graphics Muse | Tell me what you need, and I'll tell you how to
> mjhammel@graphics-muse.org | get along without it. -- Dilbert
> http://www.graphics-muse.org
>
>
>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]