question about resizing & combos
- From: Giaslas Georgios <giaslas ceid upatras gr>
- To: gtk-list redhat com
- Subject: question about resizing & combos
- Date: Tue, 26 Oct 1999 22:47:55 +0300 (EET DST)
Hi all,
i have the following two problems
i've sent this mail again but none replied to me =:-(   
1) if i have a menubar and a clist (or anything else)
   inside a container and i resize the window (make it bigger)
   both of the above widgets are resized too, but i want
only the clist to be resized.
   how can i do that?
only the clist to be resized.
   how can i do that?
2) i have a combo box and when the user selects
   a string i want all the strings before this to be removed.
   i've done it and when i change the comboentry using
   arrow keys it's ok. but when it's changed using the
   mouse i get a segmentation fault.
   Is it a bug or it's my fault?
   please try the following little program to see what
   i mean exactly.
(I use gtk+ version 1.2.6)
Please reply this time...
Thank you all
-----------------------------
#include <gtk/gtk.h>
GList *glist=NULL;
   gint active=0;
   GtkWidget *combo;
   GtkWidget *window;
   static gint delete_callback(GtkWidget *widget, gpointer data)
   {
       gtk_main_quit();
       return(FALSE);
   }
   void callback(GtkEntry *comboentry, gpointer data)
   {
       GList *l;
       gint cnt=0;
       if (active)
       {
           l=g_list_first(glist);
           while (g_strcasecmp(l->data, gtk_entry_get_text(comboentry)))
           {
               g_print("data %s deleted\n", (gchar *) l->data);
             glist=g_list_remove(glist, l->data);
               g_free(l->data);
               cnt++;
               l=g_list_first(glist);
           }
           gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist);
       }
   }
   int main (int argc, char *argv[])
   {
       gtk_init(&argc, &argv);
       window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
       gtk_signal_connect(GTK_OBJECT(window), "delete_event",
                           GTK_SIGNAL_FUNC(delete_callback), NULL);
       combo=gtk_combo_new();
       glist = g_list_append(glist, "String 1");
       glist = g_list_append(glist, "String 2");
       glist = g_list_append(glist, "String 3");
       glist = g_list_append(glist, "String 4");
       gtk_signal_connect(GTK_OBJECT(GTK_COMBO(combo)->entry), "changed",
 GTK_SIGNAL_FUNC(callback), NULL);
       gtk_combo_set_popdown_strings( GTK_COMBO(combo), glist);
       gtk_container_add(GTK_CONTAINER(window), combo);
       gtk_widget_show_all(window);
       active=1;
       gtk_main();
       return 0;
   }
--------------------------
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]