gtkmm - Gtk (mm) limit width of combobox -
because use comboboxes may contain text entries of long size, leads combobox increasing width far beyond reasonable size, trying give maximum width combobox.
if doing this:
class mycombo : public gtk::combobox { private: cellrenderertext render; public: mycombo() { render.property_width_chars() = 10; render.property_ellipsize() = pango::ellipsize_end; pack_start(render, true); } };
the result empty cell of desired width, seems logical since did not specify column show. how can attempt? using pack_start
bypass renderer...
another approach one:
class mycombo : public gtk::combobox { private: cellrenderertext render; public: mycombo() { pack_start(render, true); set_cell_data_func(render, sigc::mem_fun(*this, &mycombo::render_iter)); } void render_iter(const treemodel::const_iterator& iter) { glib::ustring data = get_string_from_iter(iter); int desired_width_chars = 10; //for example render.property_text() = ellipsize_string(data, desired_width_chars); } };
using approach, works, text in popup (what opens when u click combobox) shortened not want (obviously user should able read whole string , dont care popup widht.)
can please me this? happy advice/alternative solutions.
regards tagelicht
this may looking for:
cell_renderer_text.set_wrap_width(10)
this python, idea :-)
unfortunately, documentation scarce. found poking around in anjuta/glade.
edit:
the docs here. not overly helpful, exist.
Comments
Post a Comment