[haiku-3rdparty-dev] Re: Getting the string out of BListItem

  • From: Fredrik Modèen <fredrik@xxxxxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Thu, 26 Nov 2009 16:24:10 +0100 (CET)

> Hi!
>
> I have a list of items in a BListView (the list is a collection of
> BMessages
> that I have been able to capture). Basically, I wanted to get the name of
> the item/message that I clicked.
>
> I used the code:
> *selectedControlIndex = fIndex->CurrentSelection(); //fIndex is my
> BListView
> selectedItem = fIndex->ItemAt(selectedControlIndex); //I have initialised
> selectedItem as BListItem*
> printf("Item is %s \n", selectedItem->Text());
BListItem doesn't have a Text, what Class are selectedItem?

> *
> It doesn't print out anything regarding the item. :( So, if I select ABC
> from a list of ABC,JKL,XYZ, it does not print out the word "ABC". I had
> tried printing out just "selectedItem" but that didn't do anything. So, I
> grok-ed "CurrentSelection" and saw a similar code accessing the Text()
> method. However, my compiler tells me BListItem doesn't have any such
> properties/methods.
>
> What should I be doing here? One question. Is BListItem a special Haiku
> defined object or can I just google ListItem for C++ and assume that it
> has
> the same API?
>
> Thanks and regards,
> Yash
> *
> *
>


-- 
MVH
Fredrik Modèen


Other related posts: