width of combo




I'm creating a combo box by the following:

...

  PhysUnits = NULL;
  PhysUnits = g_list_append(PhysUnits,"um");
  PhysUnits = g_list_append(PhysUnits,"mm");
  PhysUnits = g_list_append(PhysUnits,"cm");
  PhysUnits = g_list_append(PhysUnits,"m");
  PhysUnits = g_list_append(PhysUnits,"mil");
  PhysUnits = g_list_append(PhysUnits,"inch");


#define XPAD 2
#define YPAD 1

  combo =  gtk_combo_new();
  gtk_combo_set_popdown_strings( GTK_COMBO(combo), PhysUnits);
  gtk_combo_set_use_arrows( GTK_COMBO(combo), 1);
  gtk_entry_set_editable (GTK_ENTRY(GTK_COMBO(combo)->entry), FALSE);
  gtk_table_attach(GTK_TABLE(table), combo, 2, 3, 1, 2, 0,0,XPAD,YPAD);

  /* evil call to set_usize to make this combo not be so wide */
  gtk_widget_set_usize(GTK_WIDGET(combo),60,0);

  gtk_widget_show(combo);


The problem is that without the gtk_widget_set_usize() call, the combo box
becomes quite wide.  I only want it to be wide enough to display "inch".
The table is a non-homogeneous table and as you can see I'm attaching the
combo box with expand and fill both disabled.

So is there a better way that the set_usize hack (I assume that won't work
correctly with different font settings).

Thanks

-Dan






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