[sample-DictionaryDataControl] Replace EditArea with TextBox
authorSudha <sudha.reddy@samsung.com>
Mon, 1 Apr 2013 04:54:56 +0000 (10:24 +0530)
committerSudha <sudha.reddy@samsung.com>
Mon, 1 Apr 2013 06:40:33 +0000 (12:10 +0530)
Change-Id: I00ebd74411438ccccf69fa3a9b1d961c58b7675b
Signed-off-by: Sudha <sudha.reddy@samsung.com>
project/inc/ViewDescriptForm.h
project/src/ViewDescriptForm.cpp

index b758d1d..87c36a6 100644 (file)
@@ -30,7 +30,6 @@ class ViewDescriptForm
 public:
        ViewDescriptForm(void);
        virtual ~ViewDescriptForm(void);
-       result Construct(Tizen::Base::String* pstr);
 
        bool Initialize(void);
 
@@ -47,11 +46,6 @@ public:
                                                                   const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);
        virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
                                                                        const Tizen::Ui::Scenes::SceneId& nextSceneId);
-
-
-
-private:
-       Tizen::Base::String __strDescription;
 };
 
 #endif // _VIEW_DESCRIPT_FORM_H_
index 0791f40..dfda796 100644 (file)
@@ -31,35 +31,20 @@ ViewDescriptForm::~ViewDescriptForm(void)
 {
 }
 
-result
-ViewDescriptForm::Construct(String* pStr)
+bool
+ViewDescriptForm::Initialize(void)
 {
-       __strDescription = *pStr;
-
        Form::Construct(FORM_STYLE_HEADER | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER);
 
-       EditArea* pEaEditor = new (std::nothrow) EditArea;
-       TryReturn(pEaEditor != null, E_OUT_OF_MEMORY, "new EditArea() is null");
+       TextBox* pTextBox = new (std::nothrow) TextBox();
+       TryReturn(pTextBox != null, false, "[E_OUT_OF_MEMORY] new TextBox() is null.");
 
        Rectangle rect = Rectangle(10, 10, GetClientAreaBounds().width - 20, GetClientAreaBounds().height - 15);
-       result r = pEaEditor->Construct(rect);
-       TryReturn(r == E_SUCCESS, r, "FileViewForm - EditArea::Construct() is failed by %s", GetErrorMessage(r));
-
-       pEaEditor->SetKeypadEnabled(false);
-       pEaEditor->SetEnabled(false);
+       result r = pTextBox->Construct(rect, TEXT_BOX_BORDER_NONE);
+       TryReturn(r == E_SUCCESS, false, "[%s] TextBox::Construct() failed.", GetErrorMessage(r));
 
-       r = AddControl(*pEaEditor);
-       TryReturn(r == E_SUCCESS, r, "FileViewForm - AddControl() is failed by %s", GetErrorMessage(r));
-
-       pEaEditor->SetText(__strDescription);
-
-       return E_SUCCESS;
-}
-
-bool
-ViewDescriptForm::Initialize(void)
-{
-       Form::Construct(FORM_STYLE_HEADER | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER);
+       r = AddControl(*pTextBox);
+       TryReturn(r == E_SUCCESS, false, "[%s] AddControl() failed.", GetErrorMessage(r));
 
        return true;
 }
@@ -71,17 +56,6 @@ ViewDescriptForm::OnInitializing(void)
 
        SetFormBackEventListener(this);
 
-       EditArea* pEaEditor = new (std::nothrow) EditArea;
-
-       Rectangle rect = Rectangle(10, 10, GetClientAreaBounds().width - 20, GetClientAreaBounds().height - 15);
-       pEaEditor->Construct(rect);
-
-       pEaEditor->SetKeypadEnabled(false);
-
-       AddControl(*pEaEditor);
-
-       pEaEditor->SetText(__strDescription);
-
        Header* pHeader = GetHeader();
        pHeader->SetTitleText(L"DESCRIPTION");
 
@@ -105,10 +79,13 @@ ViewDescriptForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSc
 {
        if (pArgs != null)
        {
-               __strDescription = *((String*)pArgs->GetAt(0));
+               String description = *((String*)pArgs->GetAt(0));
 
-               EditArea* pEaEditor = static_cast<EditArea*>(GetControl(0));
-               pEaEditor->SetText(__strDescription);
+               TextBox* pTextBox = dynamic_cast< TextBox* >(GetControl(0));
+               if (pTextBox)
+               {
+                       pTextBox->SetText(description);
+               }
 
                pArgs->RemoveAll(true);
                delete pArgs;