[glade--]Fwd: [gtkmm] Problem with gtkmm handling comboboxes from glade




----------  Forwarded Message  ----------

Subject: [gtkmm] Problem with gtkmm handling comboboxes from glade
Date: Thu, 29 Nov 2001 15:25:59 -0800
From: John Bartelt <bartelt ics uci edu>
To: gtkmm mailing list <gtkmm-main lists sourceforge net>

After following several suggestions from the #c++ irc (irc.gnome.org) and
searching the mailing-list archives, I'm still in a quandry about how gtkmm
handles comboboxes generated by glade(glademm?) Glade generates the following
code:
<snip>
  {
      const char * const (items[]) = { "", 0 };
      combo1->set_popdown_strings(items);
   }
<snip>

The prototype for set_popdown_strings is

void Combo::set_popdown_strings(const SArray& strings)

The compiler complains because there's no conversion available for const char
*[] to const SArray&. See attached file captured from gmake output.

It seems to me that there are three options:

1) I can edit the generated code as follows
{
	vector<string> vec_items;
	int i = 0;
	while ( items[ i ] )
	{
		vec_items.push_back( items[ i++ ];
	}
	combo1->set_pop_down_strings( vec_items );
}

This works because SAarray handles most containers. However, I have many
comboboxes in several popup dialogs in my application, and I don't like
having to find and manually edit each one. Besides, the code is in *_glade.cc
files that you're not supposed to edit - they get overwritten each time glade
rebuilds source after a design change.

2) Persuade the authors of glade(glademm) to generate the appropriate SArray
compatible container, or

3) Fix gtkmm to handle the conversion automatically.

I'd appreciate any other comments, help, or discussion.

Thanks, John.

--
John Bartelt
bartelt ics uci edu

-------------------------------------------------------



-- 
John Bartelt
bartelt ics uci edu
/usr/include/gtk--/base.h: In function `size_t 
Gtk::SArray_Helpers::Traits<T>::get_size (const T &) [with T = const 
char *const[2]]':
window1_glade.cc:704:   instantiated from here
/usr/include/gtk--/base.h:646: request for member `size' in `t', which 
is of non-aggregate type `const char *[2]'
/usr/include/gtk--/base.h: In function `const char *const 
*Gtk::SArray_Helpers::Traits<T>::get_data (const T &) [with T = const 
char *const[2]]':
window1_glade.cc:704:   instantiated from here
/usr/include/gtk--/base.h:645: request for member `begin' in `t', which 
is of non-aggregate type `const char *[2]'
/usr/include/gtk--/base.h:645: request for member `size' in `t', which 
is of non-aggregate type `const char *[2]'
gmake: *** [window1_glade.o] Error 1


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