Re: [Beginner] How to write at the end of a GtkTextBuffer ?
On 4/23/05, Olivier Ramare [EMAIL PROTECTED] wrote: Dear all, I have troubles understanding (and controlling) where to write on a GtkTextBuffer. Here are my variables : SGinfosbuffer=gtk_text_buffer_new(NULL); SGinfos=gtk_text_view_new_with_buffer(SGinfosbuffer); SGscrolledinfos=gtk_scrolled_window_new(NULL,NULL); gtk_container_add(GTK_CONTAINER(SGscrolledinfos),SGinfos); and I write in it via: void SG_print_infos(char *letexte) { gtk_text_buffer_insert_at_cursor (SGinfosbuffer,letexte,-1); while (gtk_events_pending()) gtk_main_iteration(); /* flush */ gtk_widget_show_all(SGinfos); } All goes well until the text in SGinfosbuffer gets out of the viewed area. Then some messages are repeated, and some times when I scroll the buffer down I discover the text has been inserted at uncanny places (almost reversed order sometimes). What I want : -- the info written always at the end of the buffer -- this end should be in the viewable area (scroll if needed). I can't quite get an inkling as to this last one either :-( I wrote a SQL console widget which has the same usage as the one you mention here. You can have a look at the code in the http://cvs.gnome.org/viewcvs/libgnomedb/libgnomedb/gnome-db-sql-console.c?rev=1.2view=markup file. Cheers, Vivien ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Window size and position
Thanks for all the answers. I found the reason why the window was moving slightly eveytime I stored/restored its position. From developer.gnome.org: http://developer.gnome.org/doc/API/2.0/gtk/GtkWindow.html#gtk-window-get-position --- gtk_window_get_position() is not 100% reliable because the X Window System does not specify a way to obtain the geometry of the decorations placed on a window by the window manager. Thus GTK+ is using a best guess that works with most window managers. Moreover, nearly all window managers are historically broken with respect to their handling of window gravity. So moving a window to its current position as returned by gtk_window_get_position() tends to result in moving the window slightly. Window managers are slowly getting better over time. If a window has gravity GDK_GRAVITY_STATIC the window manager frame is not relevant, and thus gtk_window_get_position() will always produce accurate results. However you can't use static gravity to do things like place a window in a corner of the screen, because static gravity ignores the window manager decorations. If you are saving and restoring your application's window positions, you should know that it's impossible for applications to do this without getting it somewhat wrong because applications do not have sufficient knowledge of window manager state. The Correct Mechanism is to support the session management protocol (see the GnomeClient object in the GNOME libraries for example) and allow the window manager to save your window sizes and positions. --- Mathias ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
connecting entry to button
Hi when press okay the title on the entry will be write on console but i cannot connect enter function to okay button program compile normaly but hiting okay it gives this error (iler:5219): GLib-GObject-WARNING **: invalid cast from `GParamBoolean' to `GtkEntry' (iler:5219): Gtk-CRITICAL **: file gtkentry.c: line 3797 (gtk_entry_get_text): assertion `GTK_IS_ENTRY (entry)' failed (null) #includegtk/gtk.h gint eventDelete(GtkWidget *widget,GdkEvent *event,gpointer data) { gtk_main_quit(); return 0; } static void enter(GtkWidget *widget,GdkEvent *event,GtkEntry *edit) { const gchar *input; input=gtk_entry_get_text(GTK_ENTRY(edit)); g_print(%s\n,input); } gint main(int argc,gchar *argv[]) { GtkWidget *window; GtkWidget *edit; GtkWidget *label; GtkWidget *label2; GtkWidget *table; GtkWidget *button1; GtkWidget *button2; gtk_init(argc,argv); button1=gtk_button_new_with_label(Cancel); button2=gtk_button_new_with_label(Okay); table=gtk_table_new(3,2,TRUE); label=gtk_label_new(Example ); label2=gtk_label_new(Name :); window=gtk_window_new(GTK_WINDOW_TOPLEVEL); edit=gtk_entry_new(); gtk_misc_set_alignment(GTK_MISC(label2), 0.0f, 0.5f); gtk_container_set_border_width(GTK_CONTAINER(window),10); edit=gtk_entry_new_with_max_length(40); gtk_entry_set_text(GTK_ENTRY(edit),Write here); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,0,1); gtk_table_attach_defaults(GTK_TABLE(table),edit,1,2,1,2); gtk_table_attach_defaults(GTK_TABLE(table),label2,0,1,1,2); gtk_table_attach_defaults(GTK_TABLE(table),button1,0,1,2,3); gtk_table_attach_defaults(GTK_TABLE(table),button2,1,2,2,3); gtk_container_add(GTK_CONTAINER(window),table); gtk_signal_connect(GTK_OBJECT(window),delete_event,GTK_SIGNAL_FUNC(eventDelete),NULL); gtk_signal_connect(GTK_OBJECT(button2),clicked,GTK_SIGNAL_FUNC(enter),(gpointer)edit); gtk_widget_show_all(window); gtk_main(); return 0; } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GnomePrinting
Hi Could anyone please tell me how to include Gnome Printing facility in my glade2, gtk2 application. Thank You Abhishek Samuel _ Trailblazer Narain Karthikeyan http://server1.msn.co.in/sp05/tataracing/ Will he be rookie of the year? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list