even yet still more cool SimpleList features



tonight i added support for editable columns and index-based selection handling in Gtk2::SimpleList.


This makes it possible to do things like

# create a list which we'll use as a table, keys in col 0, values in col 1
  $list = Gtk2::SimpleList->new (qw/Glib::String Glib::String/);

  # allow the user to change the string values to taste
  $list->set_column_editable (1, TRUE);

and

  $dlg = Gtk2::Dialog->new (...);
  ...
  $list = Gtk2::SimpleList->new ('Glib::String');
  # set the TreeView to multi-sel through the normal methods
  $list->get_selection->set_mode ('multiple');
  $list->set_reorderable (TRUE);
  # set some list data...
  @{ $list->{data} } = @bunches_of_things;
  ...
  $dlg->run;
    # here the user can muck with the selection
  ...
  # now find out which rows are selected
  @selinds = $list->get_selected_indices;
  # grab the corresponding items in a slice from the
  # list data --- note that we use the actual list data,
  # because it will reflect the order, no matter how
  # much the user reordered it!
  @selected_things = @{ $list->{data} }[ @selinds ];

i don't know about you, but i'm really excited about that second example! that's a *lot* of power for very little work!

SimpleList will be in 0.92, slated for release this friday. if you can't wait 'til then to try it out and sourceforge CVS doesn't show the lastest changes, email me offlist and i'll send you a copy. we're very anxious for bug reports and feedback on this.




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