×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    24

    CEikEdwin Problem

    hi,
    I am working with UIQ 2.1. When i used a CEIkEdwin object for creating textbox, i can't type anything. I am afraid, key press is not being received. But when i used the same code for series 60 it worked. I am wondering why is it so?
    regards,
    binu baby kurian

  2. #2
    Registered User
    Join Date
    Oct 2004
    Posts
    7

    Re: CEikEdwin Problem

    I never had any problems with using CEikEdwin with UIQ.

    Where exactly do you use them? In a Dialog or in a View?

    fred.

  3. #3
    Registered User
    Join Date
    Oct 2004
    Posts
    24

    view

    this is the code i used in my ConstructL()

    editor=new(ELeave) CEikEdwin();
    CleanupStack::PushL(editor);
    editor->ConstructL(0,20,0,20);
    editor->SetContainerWindowL(*this);
    editor->SetObserver(this);
    editor->SetExtent(TPoint(0,0),TSize(180,18));
    editor->SetFocus(ETrue,EDrawNow);
    CleanupStack::Pop();//editor
    Can anyone tell what else do i need to implement to type in my text box.

    regards
    binu baby kurian

  4. #4
    Registered User
    Join Date
    Oct 2004
    Posts
    7

    re: view

    hi binu baby kurian

    You've probabliy forgotten to implement the ComponentControl()- and CountComponentControls()-methods as should always be done using a compound control? And do not forget to handle focus if you have more than just one control...

    afterwards, you can use
    editor->GetText(aBuffer);
    to read text from the textfield

    fred.
    Last edited by fred_himself; 2004-11-08 at 12:31.

  5. #5
    Registered User
    Join Date
    Oct 2004
    Posts
    24

    Pls help

    Hi
    This is the whole code for my View Class

    #include "Simple.h"

    CSimpleAppView::CSimpleAppView()
    {
    iLabel = new (ELeave) CEikLabel;
    iText1 = new (ELeave) CEikEdwin;
    }

    CSimpleAppView* CSimpleAppView::NewL(const TRect& aRect)
    {
    CSimpleAppView* self = new(ELeave) CSimpleAppView();
    CleanupStack::PushL(self);
    self->ConstructL(aRect);
    CleanupStack::Pop();
    return self;
    }


    CSimpleAppView::~CSimpleAppView()
    {
    delete iLabel;
    delete editor;
    }

    void CSimpleAppView::ConstructL(const TRect& aRect)
    {
    CreateWindowL();

    iLabel->SetContainerWindowL(*this);
    iLabel->SetTextL(_L("Enter Password"));
    iLabel->SetExtent(TPoint(10,85),iLabel->MinimumSize());

    editor=new(ELeave) CEikEdwin();
    CleanupStack::PushL(editor);
    editor->ConstructL(0,20,0,20);
    editor->SetContainerWindowL(*this);
    editor->SetObserver(this);
    editor->SetExtent(TPoint(0,0),TSize(180,18));
    editor->SetFocus(ETrue,EDrawNow);
    CleanupStack::Pop();//editor

    SetRect(aRect);
    ActivateL();
    }

    TInt CSimpleAppView::CountComponentControls() const
    {
    return 2; // return nbr of controls inside this container
    }


    CCoeControl* CSimpleAppView::ComponentControl(TInt aIndex) const
    {
    switch ( aIndex )
    {
    case 0:
    return iLabel;
    case 1:
    return editor;
    default:
    return NULL;
    }
    }
    // Drawing the view -
    //
    void CSimpleAppView:raw(const TRect& /*aRect*/) const
    {
    // Window graphics context
    CWindowGc& gc = SystemGc();

    // Start with a clear screen
    gc.Clear();

    }

    TKeyResponse CSimpleAppView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
    {
    iEikonEnv->InfoMsg(_L("hello"));
    if(editor)
    {
    return editor->OfferKeyEventL(aKeyEvent, aType);
    }
    return EKeyWasNotConsumed;
    }


    TKeyResponse CSimpleAppView::HandleKeyEventL(
    const TKeyEvent& aKeyEvent,TEventCode aType)
    {

    return EKeyWasNotConsumed;
    }


    void CSimpleAppView::HandleControlEventL(
    CCoeControl* aControl,TCoeEvent aEventType)
    {
    return EKeyWasConsumed;
    // TODO: Add your control event handler code here
    }



    Do i need to implement anything more. If there is anything more to be implemented pls post the code for that

  6. #6
    Registered User
    Join Date
    Oct 2004
    Posts
    7

    some notes

    First of all: Never use standard-constructor for creating new controls! Do it in the second-phase constructor

    //----------------------------------------------------
    // Constructor for the view.
    //----------------------------------------------------
    //
    CSimpleAppView::CSimpleAppView()
    {
    iLabel = NULL;
    iText1 = NULL;
    }


    //----------------------------------------------------
    // Second-phase Constructor
    //----------------------------------------------------
    //
    void CSimpleAppView::ConstructL(const TRect& aRect)
    {
    // Control is a window owning control
    CreateWindowL();

    iText1 = new (ELeave) CEikEdwin;

    iLabel = new (ELeave) CEikLabel;
    iLabel->SetContainerWindowL(*this);
    iLabel->SetTextL(_L("Enter Password"));
    iLabel->SetExtent(TPoint(10,85),iLabel->MinimumSize());

    editor = new(ELeave) CEikEdwin();
    CleanupStack::PushL(editor);
    editor->ConstructL(0,20,0,20);
    editor->SetContainerWindowL(*this);
    editor->SetObserver(this);
    editor->SetExtent(TPoint(0,0),TSize(180,18));
    editor->SetFocus(ETrue,EDrawNow);
    CleanupStack::Pop();//editor

    SetRect(aRect);
    // At this stage, the control is ready to draw so
    // we tell the UI framework by activating it.
    ActivateL();
    }

Posting Permissions

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