问题
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