delphi - How to make Firemonkey XE4 HD application with idThreadComponent to work in OSX? -


i create new firemonkey hd desktop application project. put idthreadcomponent1 tool palette form1. make os x active target platform. hit f9 , debugger exception notification:

project dyld raised exception class ereaderror message 'invalid property value'.

breaking here brings application.run; continuing gives new debugger exception notification:

project dyld raised exception class ereaderror message 'error reading idthreadcomponent1.priority: invalid property value'.

application not run on os x. hint idthreadcomponent says os x 1 of supported platforms. ide bug or something? how make work? enter image description here

mac expects priority integer, instead it's given enumerated type (which works on windows), , balks error 'invalid property value'. seems solution create component during runtime:

unit unit1;  interface  uses   system.sysutils, system.types, system.uitypes, system.rtti, system.classes,   system.variants, fmx.types, fmx.controls, fmx.forms, fmx.dialogs,   fmx.stdctrls, idbasecomponent, idthreadcomponent;  type   tform1 = class(tform)     button1: tbutton;     procedure formcreate(sender: tobject);     procedure button1click(sender: tobject);   private     { private declarations }   public     { public declarations }     myidthreadcomponent: tidthreadcomponent;     procedure createthread;     procedure myidthreadcomponentonrunhandler(sender: tidthreadcomponent);     procedure myidthreadcomponentonterminatehandler(sender: tidthreadcomponent);   end;  var   form1: tform1;  implementation  {$r *.fmx}  procedure tform1.myidthreadcomponentonrunhandler(sender: tidthreadcomponent); begin   showmessage('hello');   myidthreadcomponent.terminate; end;  procedure tform1.myidthreadcomponentonterminatehandler(sender: tidthreadcomponent); begin   caption := 'thread terminated'; end;  procedure tform1.createthread; begin   myidthreadcomponent := form1.findcomponent('myidthreadcomponent')     tidthreadcomponent;   if not assigned(myidthreadcomponent)   begin     myidthreadcomponent := tidthreadcomponent.create(self);     myidthreadcomponent.onrun := myidthreadcomponentonrunhandler;     myidthreadcomponent.onterminate := myidthreadcomponentonterminatehandler; {$ifdef mswindows}     myidthreadcomponent.priority := tpnormal; {$endif} {$ifdef macos}     myidthreadcomponent.priority := 1; {$endif}   end; end;  procedure tform1.button1click(sender: tobject); begin   myidthreadcomponent.start; end;  procedure tform1.formcreate(sender: tobject); begin   createthread; end;  end. 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -