Tizen Construct() Button 方法失败
Tizen Construct() Button method fails
谁能帮助解决Tizen按钮构造问题?
在按钮和应用程序的 Construct() 调用崩溃后,我收到以下日志消息。但是在这种情况下,Construct() 返回E_SUCCESS:
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.
在下面的代码中:
MainSimpleButton::MainSimpleButton()
{
result res = Construct(FloatRectangle(50, 50, 20, 20), String("Default button"));
if (res != E_SUCCESS)
{
throw Exception("Failed Construct() button");
}
}
以下是详细信息。我已经自定义了按钮类:
#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_ */
通过以下简单实现:
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() {}
添加此自定义 Button() 的实例在此处创建:
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");
}
}
一般来说,
这是一个Tizen框架问题。建议你有一个按钮的UI应用程序。应用程序结构如下:
UIApp : [ Frame : [ Form : [ Button ] ] ]
这个简单 UI 的初始化调用链将如下所示:
OnAppInitializing():
new Frame() => Frame.Construct() =>
AddFrame(frame):
Frame.OnInitializing():
new Form() => Form.Construct() =>
AddControl(form):
Form.OnInitializing():
new Button() => Button.Construct() =>
AddControl(button):
Button.OnInitializing()
原因是:对象构造函数什么都不做(因为 Tizen 不使用异常),真正的工作是由 Construct() 方法完成的。我们可以通过使用将使用构造函数和异常的自定义对象来获得相同的结果。
OnAppInitializing():
new Frame():
Frame.Construct()
new Form():
Form.Construct()
new Button():
Button.Construct()
AddControl(button)
AddControl(form)
AddFrame(frame)
这就是我想做的。
从 Tizen 框架的角度来看,我们应该得到与每次AddFrame()/AddControl()
函数调用之前相同的结果,我们有有效的链new Object() => Object.Construct() => AddControl(Object)
。
但问题可能是,当我在手机上得到相同的结果时,日志是不同的:
04-05 02:18:04.840 : ERROR / Tizen::Ui::Controls ( 16130 : 16130 ) : Tizen::Ui::Animations::_VisualElement* Tizen::Ui::Controls::_IndicatorManager::GetIndicatorVisualElement(Tizen::Ui::_Window*, Tizen::Ui::Controls::_IndicatorOrientation, Tizen::Ui::_Control*) const(132) > [E_SYSTEM] Unable to get Indicator
04-05 02:18:04.840 : ERROR / Tizen::Ui::Controls ( 16130 : 16130 ) : result Tizen::Ui::Controls::_Indicator::AddIndicatorObject(Tizen::Ui::_Control*, Tizen::Ui::_Window*)(373) > [E_SYSTEM] Indicator can not create the surface.
04-05 02:18:04.840 : ERROR / Tizen::Ui::Controls ( 16130 : 16130 ) : Tizen::Ui::Animations::_VisualElement* Tizen::Ui::Controls::_IndicatorManager::GetIndicatorVisualElement(Tizen::Ui::_Window*, Tizen::Ui::Controls::_IndicatorOrientation, Tizen::Ui::_Control*) const(132) > [E_SYSTEM] Unable to get Indicator
04-05 02:18:04.840 : ERROR / Tizen::Ui::Controls ( 16130 : 16130 ) : result Tizen::Ui::Controls::_Indicator::AddIndicatorObject(Tizen::Ui::_Control*, Tizen::Ui::_Window*)(373) > [E_SYSTEM] Indicator can not create the surface.
04-05 02:18:04.840 : ERROR / Tizen::Ui ( 16130 : 16130 ) : result Tizen::Ui::_Control::SetFocused(bool)(2634) > [E_INVALID_OPERATION] This control should have a parent or be attached to the main tree.
因此,我认为Tizen框架不能很好地支持我的方法。
相关文章:
- CMake + Qt,moc 编译失败,无法实现 QMetaObject 方法(编译器找不到基本 ui 对象的标头?
- 指示 Qi 变换属性失败的适当方法是什么?
- 模板的模板的模板推演失败(中间有继承),有没有更好的方法.
- 有没有一种很好的方法来实现具有默认失败情况的条件类型?
- 从类方法调用命名空间中名为 Same 的函数时,重载解析失败
- 检查 istream::read 和 istream::seekg 失败的最佳方法
- 使用方法失败更改constexpr对象成员
- 将C 方法参数转换为模板参数会因编译错误而失败
- 模拟简单的c ++方法在使用googletest时失败
- NSIS系统::调用-调用方法失败
- 我的复制构造函数导致使用我的类的方法失败.有人能看一眼,告诉我我做错了什么吗
- 矢量擦除方法失败
- 自动键入到自动方法失败.为什么
- 为什么对ColMajor MappedParseMatrix调用.row()方法失败
- 当inotify的IN_DELETE事件发生时,select方法失败
- 如果CImage::Load方法失败会发生什么?
- 基于jobobject调用Java方法失败(无效引用?)
- 在libjvm中定位JNI_GetCreatedJavaVMs方法失败.dylib (Mac OS)
- Tizen Construct() Button 方法失败
- 为什么传递一个char*给这个方法失败?