Re: GtkTextView restricting



Hi,
--- Mateusz Misiorny <mateusz misiorny gmail com>
wrote:

Hi,

Is there any way to restrict the TextView to only
allow, say 5 lines of text?

BTW TextView doesnt create scrollbars, if you
set a callback to the "set_scroll_adjustments" signal
of the textview, and set these values to null.


I think you can do a 5 line TextEdit, with a callback,
and see with a lineno variable if the 
lineno > 5, characters arent append' to the
text buffer.


I think its the 'changed' signal of text-buffer
you have to connect to.

<CODE>
     /* Create statusbar */

      statusbar = gtk_statusbar_new ();
      gtk_table_attach (GTK_TABLE (table),
                        statusbar,
                        /* X direction */       /* Y
direction */
                        0, 1,                   3, 4,
                        GTK_EXPAND | GTK_FILL,  0,
                        0,                      0);

      /* Show text widget info in the statusbar */
      buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW
(contents));
      
      g_signal_connect_object (buffer,
                               "changed",
                               G_CALLBACK
(update_statusbar),
                               statusbar,
                               0);

</CODE>

Thanks
Muthu


                
__________________________________ 
Discover Yahoo! 
Find restaurants, movies, travel and more fun for the weekend. Check it out! 
http://discover.yahoo.com/weekend.html 




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