Re: GtkCombobox




Thanks to all.

Regards,
Harinandan S

On Thu, Apr 10, 2008 at 10:25 PM, Milosz Derezynski <internalerror gmail com> wrote:
gtk_tree_model_iter_n_children(GTK_TREE_MODEL(gtk_combo_box_get_model(combo)), NULL);

is better, since it uses public API

2008/4/10, Alexander Semenov <bohtvaroh gmail com>:
Hi. You can do something like this.

#include <gtk/gtk.h>

int
main (int argc, char *argv[])
{
  GtkWidget *window, *combo;
  GtkTreeModel *model;

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  combo = gtk_combo_box_new_text ();
  gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "1");
  gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "2");
  gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "3");
  gtk_container_add (GTK_CONTAINER (window), combo);

  model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
  g_assert (model);
  g_print ("%d\n", GTK_LIST_STORE (model)->length);

  gtk_widget_show_all (window);
  gtk_main ();
  return 0;

}

On Thu, 2008-04-10 at 18:13 +0530, Harinandan S wrote:
>
> Hi All,
>
> How can I find the number of entries I have in GtkCombobox during
> runtime? I use gtk_combo_box_append_text for appending strings into
> the combo box list.
>
> I'm using GTK+ 2.12.2
> --
> Regards,
> Harinandan S

> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list

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




--



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]