On Tue, 2006-12-19 at 16:21 -0800, Russell Markus wrote:
> I am trying to work on an application which has a combo box.  I want to
> restrict the user to values that are included in the drop down list only.
> My thought was to prevent the user from editing the value in the entry box,
> but I can't seem to find a way to do this.
> 
> I am running Fedora Core 6, and developed the application using glade-2.  I
> am not using the lib, but working with the generated C code.
> 
> Thanks for any assistance.


Hello Russell,

I had to do something similar recently.  I used glade to build the
interface, but then had to go back and remove the GtkComboBoxEntry
widgest and replace them with GtkCombobox widgets.

Here's the code with a note:

Note #1:  localization_sites is a global.  The value is populated by the
user via a configuration file. (gchar **localization_sites;)


void build_wfo_list (GtkWidget *combobox)
{
        gint i=0;
        gint count=0;
        
        /* FILL IN THE DROP DOWN LIST */
        count = g_strv_length(localization_sites);
        for (i=0; i<count; i++) {
        gtk_combo_box_append_text(GTK_COMBO_BOX(combobox),
                                  localization_sites[i]);
        }
                
        /* SET A DEFAULT SELECTION */
        gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 0);
}

-- Tony

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to