Array of TDesC

Login to reply to this topic.
Mon, 2007-08-06 14:23
Joined: 2007-07-31
Forum posts: 127

Hi can anybody tell me, can i create array of TDesC like int a[5];? If yes how?

In the following code i want to store the caption of the menu items in the array which i have to use later.....but this code gives error....please tell me the right way to do that....i will be thankfull to you......

class CMenu
{
TInt count;
TDesC menuItemText[10];
public:
void AddMenuItem(CWindowGc& gc,const TDesC& caption);
}
CMenu::CMenu()
{
count=0;
}
void CMenu::AddMenuItem(CWindowGc& gc,const TDesC& caption)
{
menuItemText[count]=caption;
count++;
}

Thank you....


Life is too short ! so do as many good things as you can do...
Brajesh Kumar...
Beginner in Symbian C++


Mon, 2007-08-06 14:35
Joined: 2006-04-19
Forum posts: 132
Re: Array of TDesC


Hi

Try this

CDesCArray* test = new(ELeave) CDesCArrayFlat(4);

BR
Isha


"To the question of your life , you are the only Answer. To the problems of your life,you are the only Solution".

Tue, 2007-08-07 03:42
Joined: 2004-05-21
Forum posts: 285
Re: Array of TDesC

TDesC is an abstract class so you should never create an object of that.

Cheers,
Sri

Tue, 2007-08-07 09:33
Joined: 2007-07-31
Forum posts: 127
Re: Array of TDesC

There is no any function in the class CDesCArray which returns const TDesC type because i have to pass the MenuItemText in DrawText() function....
Thank you....

Brajesh...


Life is too short ! so do as many good things as you can do...
Brajesh Kumar...
Beginner in Symbian C++

Tue, 2007-08-07 12:03
NewLC AdministratorSymbian AccreditedForum Nokia Champion
Joined: 2003-01-14
Forum posts: 1890
Re: Array of TDesC

You can get a TPtrC through the [ ] operator. And a TPtrC is a const TDesC.


Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant

  • Login to reply to this topic.