Hi, folks! Could anyone help with Button construction problem?
I'm getting the following log message after Construct() call of Button and application crashed:
result Tizen::Graphics::_Text::TextObject::SetBounds(const Tizen::Graphics::FloatRectangle&)(1134) > [E_OUT_OF_RANGE] The given rectangle(width:-4.000000,height:12.000000) is out of range.
In the following code:
MainSimpleButton::MainSimpleButton() { result res = Construct(FloatRectangle(50, 50, 20, 20), String("Default button")); if (res != E_SUCCESS) { throw Exception("Failed Construct() button"); } }
Here is details. I have customized Button class:
#ifndef MAINBUTTON_H_ #define MAINBUTTON_H_ #include <FApp.h> #include <FUi.h> #include <FGraphics.h> class MainSimpleButton : public Tizen::Ui::Controls::Button { public: MainSimpleButton(); // <------- This constructor is used MainSimpleButton(const Tizen::Graphics::Rectangle &rect, const Tizen::Base::String &text); MainSimpleButton(const Tizen::Graphics::FloatRectangle &rect, const Tizen::Base::String &text); virtual ~MainSimpleButton(); }; #endif /* MAINBUTTON_H_ */
With the following simple implementation:
MainSimpleButton::MainSimpleButton() { result res = Construct(FloatRectangle(50, 50, 20, 20), String("Default button")); if (res != E_SUCCESS) { throw Exception("Failed Construct() button"); } } MainSimpleButton::MainSimpleButton(const Rectangle &rect, const String &text) { // Similar to MainSimpleButton } MainSimpleButton::MainSimpleButton(const FloatRectangle &rect, const String &text) { // Similar to MainSimpleButton } MainSimpleButton::~MainSimpleButton() {}
Add instance of this customized Button() is created here:
void MainForm::InitMainForm(unsigned long formStyle) { if (Construct(formStyle) != E_SUCCESS) { throw Exception("MainForm Construct() failed"); } MainSimpleButton *btn1 = new MainSimpleButton(); // <----- This code if (AddControl(btn1) != E_SUCCESS) { throw Exception("MainForm AddControl() failed"); } }