Re: TreeModel selected row number



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"

John



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