[gtkada] Re: Scrolled window
Manuel Op de Coul
Manuel.Op.de.Coul at ezh.nl
Wed Apr 26 15:19:15 CEST 2000
I looked at create_text.adb in testgtk/ but couldn't find a reason
why my example wouldn't work. The difference in create_text.adb is that
no lines are added after the scrolled text widget is drawn.
I suspect it may be a bug in Gtk.
With the attachments the behaviour can be reproduced. Generate the
sources with the Glade file, and then replace window1_pkg-callbacks.adb.
The make command is
gnatmake -g -O2 -gnata project2 `gtkada-config`
Note that lines fall out of the viewport and the slider is not updated.
Manuel Op de Coul
-------------- next part --------------
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>Project2</name>
<program_name>project2</program_name>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>Ada 95</language>
<gnome_support>False</gnome_support>
<gettext_support>False</gettext_support>
<use_widget_names>False</use_widget_names>
<output_main_file>True</output_main_file>
<output_support_files>True</output_support_files>
<output_build_files>True</output_build_files>
<backup_source_files>True</backup_source_files>
<main_source_file>interface.c</main_source_file>
<main_header_file>interface.h</main_header_file>
<handler_source_file>callbacks.c</handler_source_file>
<handler_header_file>callbacks.h</handler_header_file>
<support_source_file>support.c</support_source_file>
<support_header_file>support.h</support_header_file>
<translatable_strings_file></translatable_strings_file>
</project>
<widget>
<class>GtkWindow</class>
<name>window1</name>
<title>window1</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<default_height>120</default_height>
<allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<widget>
<class>GtkVBox</class>
<name>vbox1</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow1</name>
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkText</class>
<name>text1</name>
<can_focus>True</can_focus>
<editable>False</editable>
<text></text>
</widget>
</widget>
<widget>
<class>GtkButton</class>
<name>button1</name>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_button1_clicked</handler>
<last_modification_time>Wed, 26 Apr 2000 12:49:27 GMT</last_modification_time>
</signal>
<label>Add one line</label>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>
</GTK-Interface>
-------------- next part --------------
with Glib; use Glib;
with Gdk.Event; use Gdk.Event;
with Gdk.Types; use Gdk.Types;
with Gtk.Accel_Group; use Gtk.Accel_Group;
with Gtk.Object; use Gtk.Object;
with Gtk.Enums; use Gtk.Enums;
with Gtk.Style; use Gtk.Style;
with Gtk.Widget; use Gtk.Widget;
with Gdk.Color; use Gdk.Color;
with Gdk.Font; use Gdk.Font;
package body Window1_Pkg.Callbacks is
use Gtk.Arguments;
Count : Natural := 0;
------------------------
-- On_Button1_Clicked --
------------------------
procedure On_Button1_Clicked
(Object : access Gtk_Button_Record'Class)
is
begin
Freeze(Window1.Text1);
Insert(Window1.Text1,
Font => Null_Font,
Fore => Null_Color,
Back => Null_Color,
Chars => Integer'Image(Count) & Ascii.Lf,
Length => -1);
Thaw(Window1.Text1);
Count := Count + 1;
end On_Button1_Clicked;
end Window1_Pkg.Callbacks;
More information about the gtkada
mailing list