scrolling GtkText
- From: Michal ROMAN <michal roman nov sk>
- To: gtk-app-devel-list gnome org
- Subject: scrolling GtkText
- Date: Thu, 19 Jul 2001 20:10:38 +0200
Hi,
Can you help me with connecting hscrollbar to GtkText?
I have this code in my program :
text3 = gtk_text_new (NULL, NULL);
gtk_widget_ref (text3);
gtk_text_set_line_wrap (GTK_TEXT (text3), FALSE);
gtk_table_attach (GTK_TABLE (table1), text3, 0, 1, 0, 1,
(GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL),
(GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL), 0, 0);
gtk_widget_show (text3);
vscrollbar1 = gtk_vscrollbar_new (GTK_TEXT (text3)->vadj);
gtk_widget_ref (vscrollbar1);
gtk_widget_show (vscrollbar1);
gtk_table_attach (GTK_TABLE (table1), vscrollbar1, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_EXPAND |
GTK_SHRINK | GTK_FILL), 0, 0);
hscrollbar1 = gtk_hscrollbar_new (GTK_TEXT (text3)->hadj);
gtk_widget_ref (hscrollbar1);
gtk_object_set_data_full (GTK_OBJECT (window2), "hscrollbar1",
hscrollbar1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hscrollbar1);
gtk_table_attach (GTK_TABLE (table1), hscrollbar1, 0, 1, 1, 2,
(GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 0, 0);
gtk_widget_realize (text3);
freport = fopen (file_name, "r");
do
{
size = fread (buffer, 1, MAX_BUFFER, freport);
memcpy (text_buffer, buffer, size);
gtk_text_insert (GTK_TEXT (text3), fixed_font, NULL, NULL,
text_buffer, size);
}
while (size == MAX_BUFFER);
fclose (freport);
Vertical scrollbar is OK, but horizontal scrollbar doesn't scroll
GtkText left and right. Why? What I am dooing wrong?
Thank's all.
Michal.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]