语言

Menu
Sites
Language
EditField Problem

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.

编辑者为: Brock Boland 17 3月, 2014 原因: Paragraph tags added automatically from tizen_format_fix module.

响应

6 回复
I don't know if you can disable they keypad but other solution is to have Label in the place of the EditField. Hide the editfield and show the label
Pushpa G
you can also write pField[i]->SetKeypadEnabled(false);
Siddharth Singh
This will work.....SetKeypadEnabled(false)
Bikramjit Das
SetKeypadEnabled(false);...is of course working. The problem was because of redrawing the form or the particular EditField..That can be done by calling the Draw() function of the EditField object.
Bikramjit Das
SetKeypadEnabled(false);...is of course working. The problem was because of redrawing the form or the particular EditField..That can be done by calling the Draw() function of the EditField object.
Bikramjit Das
SetKeypadEnabled(false);...is of course working. The problem was because of redrawing the form or the particular EditField..That can be done by calling the Draw() function of the EditField object.