Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor sirmic's Avatar
    Join Date
    Feb 2008
    Location
    Russia Saint-Petersburg
    Posts
    61
    I created button CEikTextButton but it is not displayed.What is wrong?
    Here is my code:
    Code:
    void CMikhail2AppView::ConstructL( const TRect& aRect )
    {
    ...
     TResourceReader reader1;
     iCoeEnv->CreateResourceReaderLC(reader1,ZQ_BUTTON);
     button = new (ELeave) CEikTextButton();
     button->ConstructFromResourceL(reader1);
     CleanupStack::PopAndDestroy(); 
     button->SetContainerWindowL(*this);
     button->SetObserver(this);
     button->MakeVisible(ETrue);
     button->SetFocus(ETrue);
    ...
    }
    void CMikhail2AppView::Draw( const TRect& /*aRect*/) const
    {
     _LIT(buttonText,"Click My Button");
     button->SetTextL(buttonText,CEikTextButton::EFirst);
     button->SetPosition(TPoint(50,50));
     button->SetSize(TSize(100,30));
     button->SetParent(button->Parent());
     button->DrawNow();
    }

  2. #2
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    You should rather try the 'traditional', compound control approach: provide a CountComponentControls and ComponentControl method, and return your button (which would be better called iButton).

  3. #3
    Nokia Developer Champion neois's Avatar
    Join Date
    Mar 2004
    Posts
    130
    Yes, please do as wizard_hu_ suggested. It should be something like this.

    Code:
    TInt CMikhail2AppView::CountComponentControls() const
    {
    	return 1; // Amount of Components
    }
    
    CCoeControl* CMikhail2AppView::ComponentControl(TInt aIndex) const
    {
    	switch (aIndex)
    	{
    		case 0:
    			return button;
    		default:
    			return NULL;
    	}
    }

  4. #4
    Registered User pbhimellu's Avatar
    Join Date
    Feb 2008
    Posts
    33
    Another way is to add the individual components to the container components control array as the CCoeControl implements the ComponentControl() and CountComponentControl() methods past 9.0 releases.

    And not to forget to have the window owning compound control if your application does not have any window owning control.

    Normally the view class contains the container class object which is a window owner control.The container contains the other compound controls which share the "Window" owned by the container.

Similar Threads

  1. S60 SDK 3rd edition FP1 Emulator problem
    By justteam in forum Symbian Tools & SDKs
    Replies: 14
    Last Post: 2010-03-23, 08:47
  2. console app running problem
    By xcompass in forum Symbian C++
    Replies: 3
    Last Post: 2009-05-08, 13:26
  3. Add a control (e.g. button) programmatically
    By ViRuSTriNiTy in forum Symbian User Interface
    Replies: 2
    Last Post: 2008-01-02, 21:05
  4. RNotifier Notify(..) only one button
    By marcinkrol84 in forum Symbian C++
    Replies: 1
    Last Post: 2007-06-22, 16:09
  5. Replies: 1
    Last Post: 2006-02-26, 14:23

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved