EditField Problem

EditField Problem

BY 01 Aug 2013 Native Application Development

Hi,

I am trying to make an app where i have taken numerous EditFields through array of EditField objects. Now on the same form i have a button. I want that as soon as the button is pressed, some of the EditFields should be changed so that on tapping on the EditFields keyboard doesnt showup. Also, some values should appear on those particular EditFields. Basically i want to make those EditFields non editable.

The following is the source code which i am trying with but is not giving the intended result.
EditField* pField[16];

result
TTTPlayForm::OnInitializing(void)

{

    result r = E_SUCCESS;

    GridLayout gridPanelLayout;
    gridPanelLayout.Construct(4, 4);

    Panel* pPanel = new Panel();
    pPanel->Construct(gridPanelLayout, Rectangle(0, 100, 400, 400));

    for (int i = 0; i < 16; i++)
    {
        pField[i] = new EditField();
        pField[i]->Construct(Rectangle(0, 100, 100, 100), EDIT_FIELD_STYLE_PHONE_NUMBER_SMALL, INPUT_STYLE_OVERLAY, EDIT_FIELD_TITLE_STYLE_NONE);
        pField[i]->SetTextAlignment(ALIGNMENT_LEFT);
        pPanel->AddControl(pField[i]);
    }

    AddControl(pPanel);
    return r;

}

....

result
TTTPlayForm::GenerateRandomNUmbers(int Limit)
{
    result r = E_SUCCESS;
    srand(time(NULL));
    r = rand() % Limit + 1;
    return r;
}

void
TTTPlayForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
{
    SceneManager* pSceneManager = SceneManager::GetInstance();
    AppAssert(pSceneManager);

    switch(actionId)

    {
        case ID_BUTTON_START:
            AppLog("Start Button clicked!");
            for(int i = 0; i < 16; i++)
            {
                int disabledBox = GenerateRandomNUmbers(3);
                if (1 == disabledBox)                //disable the keypad for that box
                {
                    pField[i]->SetKeypadEnabled(false);
                    pField[i]->SetText("3");
                }
               else
                    continue;
            }

    }
}

 

Thanks in advance.

Written by