简体   繁体   English

在Mac OS X上从资源加载样式

[英]Loading style from resource on Mac OS X

Using Firemonkey (FMX) in C++ Builder XE6, I am attempting to load a style in my project's cpp file. 我试图在C ++ Builder XE6中使用Firemonkey(FMX),将样式加载到项目的cpp文件中。

Just before 就在之前

Application->Initialize ()

I have 我有

Fmx::Types::TFmxObject *style;
style = TStyleStreaming::LoadFromResource((unsigned int)HInstance, L"MacJet", RT_RCDATA);
TStyleManager::SetStyle (style);

where the style named MacJet has been loaded as a resource into the project at design time. 在设计时,名为MacJet的样式已作为资源加载到项目中。

When I activate Win32 as the target platform, this runs fine, and the style shows properly in the application. 当我激活Win32作为目标平台时,它运行良好,并且样式在应用程序中正确显示。

When I activate Mac OS X, however, I get an error on the style = ... line, stating 但是,当我激活Mac OS X时,出现style = ...行错误,提示

"Exception class SIGSEGV (11)." “异常类SIGSEGV(11)。”

When I remove the three lines above and run on Mac, the program loads up. 当我删除上面的三行并在Mac上运行时,程序会加载。

I'm new to cross-platform development, any ideas what is causing this error? 我是跨平台开发的新手,有什么主意导致此错误?

解决方法:在应用程序初始化之前,我没有使用资源并加载样式,而是在应用程序的主窗体中添加了TStyleBook,在设计时将样式添加到样式簿中,然后调用TStyleManager :: SetStyle()来传递样式簿的Style属性,用于在主窗体的Create事件上设置应用程序的样式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM