Commit 9b6fc4d82cb522d4254ba2446b90deda6d0c4caa

Authored by joogab yun
Committed by Gerrit Code Review
2 parents 6307bc22 af9fba45

Merge "Dali_test: add test for enable_editing" into devel/master

examples/simple-text-field/simple-text-field.cpp
... ... @@ -59,7 +59,6 @@ public:
59 59 mTextField.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
60 60 mTextField.SetProperty(Actor::Property::SIZE, Vector2(300.f, 60.f));
61 61 mTextField.SetBackgroundColor(Color::WHITE);
62   - mTextField.SetBackgroundColor(Vector4(1.f, 1.f, 1.f, 0.15f));
63 62  
64 63 mTextField.SetProperty(TextField::Property::TEXT_COLOR, Color::BLACK);
65 64 mTextField.SetProperty(TextField::Property::PLACEHOLDER_TEXT, "Unnamed folder");
... ... @@ -82,12 +81,20 @@ public:
82 81 mButtonSelectionEnd.SetProperty(Button::Property::LABEL, "select -->");
83 82 mButtonSelectionEnd.ClickedSignal().Connect(this, &SimpleTextFieldExample::OnButtonClicked);
84 83  
  84 + mBtnEditable = PushButton::New();
  85 + mBtnEditable.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
  86 + mBtnEditable.SetProperty(Actor::Property::SIZE, Vector2(250.f, 80.f));
  87 + mBtnEditable.SetProperty(Actor::Property::POSITION, Vector2(0, 220.f));
  88 + mBtnEditable.SetBackgroundColor(Color::RED);
  89 + mBtnEditable.SetProperty(Button::Property::LABEL, "Non-editable");
  90 + mBtnEditable.ClickedSignal().Connect(this, &SimpleTextFieldExample::OnButtonClicked);
  91 +
85 92 window.Add(mTextField);
86 93 window.Add(mButtonSelectionStart);
87 94 window.Add(mButtonSelectionEnd);
  95 + window.Add(mBtnEditable);
88 96 }
89 97  
90   -
91 98 bool OnButtonClicked(Button button)
92 99 {
93 100 if(button == mButtonSelectionStart)
... ... @@ -103,6 +110,21 @@ public:
103 110 {
104 111 mTextField.SetProperty(DevelTextField::Property::SELECTED_TEXT_END , mTextField.GetProperty(DevelTextField::Property::SELECTED_TEXT_END).Get<int>() + 1);
105 112 }
  113 + else if (mBtnEditable == button)
  114 + {
  115 + bool bEditable = !mTextField.GetProperty( DevelTextField::Property::ENABLE_EDITING).Get<int>();
  116 + mTextField.SetProperty( DevelTextField::Property::ENABLE_EDITING , bEditable);
  117 + if (bEditable)
  118 + {
  119 + mBtnEditable.SetProperty(Button::Property::LABEL, "Non-editable");
  120 + mBtnEditable.SetBackgroundColor(Color::RED);
  121 + }
  122 + else
  123 + {
  124 + mBtnEditable.SetProperty(Button::Property::LABEL, "editable");
  125 + mBtnEditable.SetBackgroundColor(Color::GREEN);
  126 + }
  127 + }
106 128  
107 129 return true;
108 130 }
... ... @@ -126,6 +148,7 @@ private:
126 148 TextField mTextField;
127 149 PushButton mButtonSelectionStart;
128 150 PushButton mButtonSelectionEnd;
  151 + PushButton mBtnEditable;
129 152 };
130 153  
131 154 void RunTest(Application& application)
... ...