Re: [gtk-list] Re: GtkText widget handling of "default values"
- From: Andreas Tille <tille physik uni-halle de>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: GtkText widget handling of "default values"
- Date: Wed, 7 Apr 1999 16:58:46 +0200 (METDST)
On Tue, 6 Apr 1999 john@giorgio.hart.bbk.ac.uk wrote:
> Hi Andreas, have you tried gtk_entry_select_region()? I think this does what
> you're asking for.
Now I tried ist using the testgtk.c example stripped to the core of
the GtkEntry part. I appended this as "entry.c". I'm a little bit
confused, why the second entry (in fact ist is the *last* entry, if
you copy the few lines which create a new entry) is white text on blue
and the first (in fact all lines before the last) is black text on
gray. Is there any sense for a special colouring of the last entry?
Please note that this colouring is independent form having the focus
or not.
The more importand problem is that this example works, but if I
want to use an entry, which I create in exactly the same manner,
works different, that means doesn't show the wished behaviour, if
I put it into a cell of a GtkTable widget. Do I have it to put
it into a box acting as a container and put this box into the
table that entry works right?
(I could ship an example for the table too, if the case is not
clear.)
I would consider this as a misfeature.
Kind regards
Andreas.
#include <gtk/gtk.h>
static void
do_exit (GtkWidget *widget, GtkWidget *window)
{
gtk_widget_destroy (window);
gtk_main_quit ();
}
static void
create_entry (void)
{
static GtkWidget *window = NULL;
GtkWidget *box1;
GtkWidget *box2;
GtkWidget *entry;
GtkWidget *button;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC(gtk_widget_destroyed),
&window);
gtk_window_set_title (GTK_WINDOW (window), "entry");
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
box1 = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), box1);
gtk_widget_show (box1);
box2 = gtk_vbox_new (FALSE, 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2);
entry = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (entry), "hello first entry");
gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
gtk_box_pack_start (GTK_BOX (box2), entry, TRUE, TRUE, 0);
gtk_widget_show (entry);
entry = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (entry), "hello second entry");
gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
gtk_box_pack_start (GTK_BOX (box2), entry, TRUE, TRUE, 0);
gtk_widget_show (entry);
button = gtk_button_new_with_label ("close");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC(do_exit),
GTK_OBJECT (window));
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
gtk_widget_show (button);
gtk_widget_show (window);
}
gint
main(gint argc, char *argv[])
{
gtk_init(&argc, &argv);
create_entry();
gtk_main();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]