Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jan 2005

    What type of control is stored in an array of controls?

    Hi All,

    I'm using a CArrayPtrFlat array for storing different type of controls
    within my view through
    CArrayPtrFlat<CCoeControl>* iControls = new CArrayPtrFlat<CCoeControl>(1);
    For the different controls within my view I create and append it to the

    Now I want to iterate through the entire array and display a message as to
    what kind of control has been stored in the array.
    Though I have the index available but I don't know how to display which type
    of control has been stored in the CArrayPtrFLat array.
    It'd be of great help if someone could provide a code snippet or a pointer
    as to how can I while iterating through the controls array, display messages
    to what kind of control is stored in the particular index?

    I'd need to perform certain casts, but I'm not sure how?

    Any help will be greatly appreciated.

    Thanks & regards,

  2. #2
    Regular Contributor
    Join Date
    Feb 2005
    Firstly, I would recommend using an RPointerArray to own your list of controls as this is more efficient that a CPtrArrayFlat.

    What you could do is create a new class as follows:

    class CNamedControl : public CBase
    CNamedControl(CCoeControl* aControl, const TDesC& aName);
    virtual ~CNamedControl();
    const TDesC& Name();
    CCoeControl* Control();
    HBufC* iName;
    CCoeControl* iControl;

    Then keep an array of CNamedControl in a RPointerArray and when you want to get information about the given control, the name is available.

    Of course this assumes that the name/type is known when it is added to the array...

  3. #3
    Registered User
    Join Date
    Jan 2005
    Thanks a lot, template. I'll try out your approach and let you know.
    Thanks & regards,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts