How can I get the main text of CAknDoubleLargeStyleListBox control
I have a listbox control in symbian of type CAknDoubleLargeStyleListBox
, and I want to get the selected item Main text, Not the icon index or the sec开发者_如何学JAVAondary text.How can I do that knowing that the item consists of "Icon Index \t Main Text \t Secondary Text
"
The best way to do this is to manually parse the Descriptor.
TBufC<128> string = "Icon Index \t Main Text \t Secondary Text"
int firstSeparator = string.Find(_L("\t"));
int secondSeparator = string.Right( string.Length() - firstSeparator -2).Find(_L("\t"));
secondSeparator+= firstSeparator;
TBuf<128> mainString = string.Mid(firstSeparator,secondSeparator);
You might have to fine tune the code to eliminate compile errors.
Many thanks Abhijith for your help, I found also a great solution in symbian to do the job just in one line.
static IMPORT_C TInt ColumnText(TPtrC &aColumnText, TInt aColumn, const TDesC *aSourceText, TChar aColumnSeparator=KColumnListSeparator);
TextUtils::ColumnText(Returned Column,Column Number, Whole text, Delimiter)
More information could be found in Symbian S60 3rd Ed SDK.
精彩评论