On Tue, 2005-03-22 at 10:07 -0700, John Taber wrote:
> On Tuesday 22 March 2005 09:35, Murray Cumming wrote:
> > > It is actually very useful if the tree is being used as any sort of list
> > > box.
> >
> > I don't understand. You have a list of colors, for example. You can find
> > out what color has been selected. Why do you need to know what
> > alphabetical sort position the color had in a list?
> >
> simply for flexibility and to avoid string comparisons 
> 
> int rowSelected = treeModel.row_selected()
> switch (rowSelected) {
>   case 0: {
>     ...
>     //if I want to key to somethingelse[rowSelected]
> .......
> 
> currently I think this would have to be done:
> std::string color = row[menuColums.color] 
> if (color == "blue") {...}
>   //if I want to key to somethingelse have to find index of "blue"

An id column will do the same, I think. I also doubt that the string
comparison will be a significant performance hit in an app that's
probably waiting most of the time anyway.

Maybe you are just used to using indexes because that's what lesser APIs
forced you to use.

-- 
Murray Cumming
[EMAIL PROTECTED]
www.murrayc.com
www.openismus.com

_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to