Loading style from resource on Mac OS X

纵饮孤独 提交于 2019-12-11 02:49:32

问题


Using Firemonkey (FMX) in C++ Builder XE6, I am attempting to load a style in my project's cpp file.

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.

When I activate Win32 as the target platform, this runs fine, and the style shows properly in the application.

When I activate Mac OS X, however, I get an error on the style = ... line, stating

"Exception class SIGSEGV (11)."

When I remove the three lines above and run on Mac, the program loads up.

I'm new to cross-platform development, any ideas what is causing this error?


回答1:


Workaround solution: instead of using a resource and loading the style before the application initialized, I added a TStyleBook to the application's main form, added the style to the stylebook at design time, and then called TStyleManager::SetStyle () passing in the stylebook's Style property to set the application's style on the main form's Create event.



来源:https://stackoverflow.com/questions/23741597/loading-style-from-resource-on-mac-os-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!