×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    17

    Simple UI Questions

    1. How do i insert a "carriage return" char into CEikEdwin?
    the code:
    --------
    CEikSearhField* iChatField;
    CEikEdwin* iChatArea;
    ------------------------
    iChatField->GetSearchText(buf);
    iChatArea->Text()->InsertL(iChatArea->TextLength(), buf);
    iChatArea->Text()->InsertL(iChatArea->TextLength(), TChar('\n'));
    //iChatArea->Text()->InsertL(iChatArea->TextLength(), TChar(0x000A));
    //iChatArea->Text()->InsertL(iChatArea->TextLength(), TChar(0x000D));
    iChatArea->UpdateAllFieldsL();

    i can insert a tab character ('\t'), but doesn't work on "carriage return" character('\n'). any idea?


    2. I have the following two Class - CAppView (inherits CCoeControl, MCoeControlObserver)and CBoard (inherits CCoeControl, MCoeControlObserver).
    CBoard implements the game board such as "checkers". For user movement, the arrows key is used. what i do is to trap the key event in the following code:

    void CAppView::ConstructL(const TRect& aRect)
    {
    iBoard = new(ELeave) CBoard;
    iBoard->SetContainerWindowL(*this);
    iBoard->ConstructL(aRect);
    iBoard->SetObserver(this);
    SetRect(aRect);
    ActivateL();
    }

    TKeyResponse CAppView::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
    {
    return iBoard->OfferKeyEventL(aKeyEvent, aType);
    }

    TKeyResponse CBoard::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
    {
    switch (aKeyEvent.iScanCode)
    {
    case EStdKeyRightArrow:
    iCurrentGrid++; // type TInt, to know which grid has the focus
    // code of redraw the grid to reflect the new focused grid
    return EKeyWasConsumed;
    break;
    // similar code goes here for up, down, and left arrow movement
    default:
    break;
    }
    return EKeyWasNotConsumed;
    }

    the problem is whenever i press the arrows movement, the event is generated 3 times by the system. so it moves 3 grids for one key press. please help with this simple bugs. thanks =)

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    73

    RE: Simple UI Questions

    #include <txtetext.h>

    and use "CEditableText::ELineBreak"

    or as a shortcut just use: TChar('0x2028')

Posting Permissions

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