Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. void ordenar(Gtk::ComboBoxText* combo) {
  2.     combo->set_active(0);
  3.     Glib::ustring texto;
  4.     std::list< Glib::ustring > contenido;
  5.     //Capturo los elementos del combobox en una lista
  6.     while (combo->get_active_row_number() != -1) {
  7.         texto = combo->get_active_text();
  8.         combo->remove_text(texto);
  9.         contenido.push_back(texto);
  10.         combo->set_active(0);
  11.     }
  12.     //Ordeno la lista
  13.     contenido.sort();
  14.     //Cargo el combobox nuevamente
  15.     std::list< Glib::ustring >::const_iterator it = contenido.begin();
  16.     for (contenido.begin() ; it != contenido.end(); ++it)
  17.         combo->append_text(*it);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement