GtkEntry +GtkNotebook +win32 bug
- From: "HOCHSTETLER, BRUCE W. (JSC-DV3/T) (TSI)" <bruce w hochstetler1 jsc nasa gov>
- To: "'gtk-app-devel-list gnome org'" <gtk-app-devel-list gnome org>
- Subject: GtkEntry +GtkNotebook +win32 bug
- Date: Wed, 19 May 2004 17:38:31 -0500
I originally posted this back on 5/4, but got no response. Since then I've
discovered that the problem only exists on win32 platforms.
BTW, GTK version=2.2.4, don't know if it exists in the 2.4.x delivery.
First off I'm probably stretching the notebook api a bit. What I'm trying to
do is allow the user the ability to edit the tabname. To accomplish this, I
created a GtkEntry and placed it into each page that I created. The problem
is the entry doesn't accept input changes. If I scroll the tabs out of view,
then scroll the tab back into view, the entry will accept input. If all the
tabs are showing initially, you can never get input control! I've since
built this application on a linux and hp-alpha (true64) unix system, neither
exhibit this problem.
--bruce
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
static GtkWidget *create_tabname(gint i)
{
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *entry;
gchar name[32];
hbox = gtk_hbox_new(FALSE, 0);
{
label = gtk_label_new(" "); /* allow area for right-popup */
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
entry = gtk_entry_new();
sprintf(name, "Foo #%d", i);
gtk_entry_set_text(GTK_ENTRY(entry), name);
gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
}
return hbox;
}
static gboolean on_window_delete (GtkWidget *widget, GtkWidget *event,
gpointer data)
{
gtk_main_quit();
return FALSE;
}
gint main (gint argc, gchar **argv)
{
GtkWidget *window, *vbox;
GtkNotebook *notebook;
GtkWidget *label;
GtkWidget *tab_name;
gint i;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Tab Test");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 100);
gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
g_signal_connect (G_OBJECT (window), "delete_event",
G_CALLBACK (on_window_delete), NULL);
vbox = gtk_vbox_new (FALSE, 0);
notebook = GTK_NOTEBOOK (gtk_notebook_new ());
gtk_notebook_set_tab_pos (notebook, GTK_POS_TOP);
gtk_notebook_set_scrollable(notebook, TRUE);
gtk_notebook_popup_enable(notebook);
gtk_container_set_border_width (GTK_CONTAINER (notebook), 10);
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (notebook),
TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_widget_show_all (GTK_WIDGET (window));
for (i = 0; i < 7; i++)
{
label = gtk_label_new("doesn't matter what this is");
tab_name = create_tabname(i);
gtk_widget_show_all(tab_name);
gtk_notebook_append_page (notebook, label, tab_name);
}
gtk_widget_show_all (GTK_WIDGET (notebook));
gtk_main ();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]