Re: Auto Scrolling



Brian,

I noticed it does actually scroll, it just always goes back to the first line again. Even after appending hundreds, it goes to the first.

Here is the code I'm using to define my TextView and my Iterator.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
struct AtePane * ate_pane_new( struct ConfigConsole * console, gchar * name ) {
   struct AtePane * retval;
   GtkWidget * text;
   GtkWidget * root;
   GtkTextBuffer * buffer;
   GtkTextIter iter;

   retval = ( struct AtePane * )g_malloc( sizeof( struct AtePane * ) );
   atepane_location_set( retval, name );

   text = gtk_text_view_new();
   buffer = gtk_text_view_get_buffer( text );
   root = gtk_scrolled_window_new( NULL, NULL );

   gtk_widget_show( text );
   gtk_widget_show( root );

   atepane_root_set( retval, root );
   atepane_buffer_set( retval, text );
   gtk_text_buffer_get_end_iter( buffer, &iter );
   gtk_text_buffer_create_mark( buffer, "scroll", &iter, FALSE );

   gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), FALSE );

   gtk_scrolled_window_set_policy
           ( GTK_SCROLLED_WINDOW( atepane_root_get( retval ) ),
             GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );

   gtk_scrolled_window_add_with_viewport
           ( GTK_SCROLLED_WINDOW( atepane_root_get( retval ) ),
             GTK_WIDGET( atepane_buffer_get( retval ) ) );
   return retval;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Leo


Brian wrote:

On Fri, 2004-10-29 at 09:50 -0700, Leo Przybylski wrote:
It seems to work for me except for some reason the ScrollingWindow always rescrolls to the top. Does anyone on the list know why this is happening or how I get it to stop?

Leo


The textmarks can be set to left or right justified when created.  Your
mark is probably set wrong so that text is inserted after it instead of
before it.   If you set it opposite what you have it will most likely
work.




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