TextView problem on Win32
- From: "Andrew E. Makeev" <andrew solvo ru>
- To: gtk-list <gtk-list gnome org>
- Subject: TextView problem on Win32
- Date: Fri, 10 Mar 2006 13:00:20 +0300
Good day.
GtkTextView widget has redrawing problems on Win32 platform.
Configuration:
Gtk+-2.4.14, Windows XP professional, MinGW.
See attached testcase and screenshot.
Compilation string: "gcc -mms-bitfields -o test Win32Textbuffer.c
`pkg-config --cflags --libs gtk+2.0`"
Description.
TextView packed in ScrolledWindow.
Button - click to add anchored child in textview (GtkEntry).
If you scroll textview you see that entry widgets drawn not fully.
Regards,
-andrew
#include <gtk/gtk.h>
GtkTextBuffer* buff;
GtkWidget* text;
static void add_widget_cb()
{
GtkTextIter iter;
GtkTextChildAnchor* anchor;
GtkWidget* entry;
gtk_text_buffer_get_end_iter( buff, &iter );
anchor = gtk_text_buffer_create_child_anchor( buff, &iter );
entry = gtk_entry_new();
gtk_text_view_add_child_at_anchor( GTK_TEXT_VIEW( text ), entry, anchor );
gtk_widget_show( entry );
}
GtkWidget* create_app()
{
GtkWidget* window;
GtkWidget* box;
GtkWidget* sw;
GtkWidget* button;
window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
gtk_window_set_title( GTK_WINDOW( window ), "Textview Test" );
box = gtk_vbox_new( FALSE, 0 );
gtk_container_add( GTK_CONTAINER( window ), box );
gtk_widget_show( box );
sw = gtk_scrolled_window_new( NULL, NULL );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( sw ),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC );
gtk_box_pack_start( GTK_BOX( box ), sw, TRUE, TRUE, 2 );
gtk_widget_show( sw );
buff = gtk_text_buffer_new( NULL );
text = gtk_text_view_new_with_buffer( buff );
gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( text ), GTK_WRAP_WORD );
gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), FALSE );
gtk_text_view_set_cursor_visible( GTK_TEXT_VIEW( text ), FALSE );
gtk_text_view_set_pixels_inside_wrap( GTK_TEXT_VIEW( text ), 0 );
gtk_text_view_set_indent( GTK_TEXT_VIEW( text ), 0 );
gtk_container_add( GTK_CONTAINER( sw ), text );
gtk_widget_show( text );
button = gtk_button_new_with_label( "Create" );
g_signal_connect( G_OBJECT(button),
"clicked",
G_CALLBACK( add_widget_cb ),
NULL );
gtk_box_pack_start( GTK_BOX( box ), button, TRUE, FALSE, 2 );
gtk_widget_show( button );
return window;
}
int main( int argc, char* argv[] )
{
GtkWidget* app;
gtk_init( &argc, &argv );
app = create_app();
g_signal_connect( G_OBJECT( app ),
"destroy",
G_CALLBACK( gtk_main_quit ),
NULL );
gtk_widget_show( app );
gtk_main();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]