delphi - TCheckBox.Data invalid typecast when using as TValue -


steps reproduce:

-new firemonkey-application

-add tcheckbox form

now create method following code:

procedure tform1.foo; var a,b:integer; lval:tvalue; begin   lval:=tvalue.from<integer>(42);   a:=lval.asinteger;   checkbox1.data:=tvalue.from<integer>(42);   b:=checkbox1.data.asinteger; end;    

the cast lval runs without problems, checkbox1.data however, if it's tvalue too, throws "einvalidcast"-error, when calling asinteger. same error appears when using checkbox1.data.astype<integer> instead.

am misusing tcheckbox.data here or kind of bug?

tcheckbox.data contains boolean value, check box checked state. why einvalidcast error when try read integer it.

the reason why seemingly can put integer data in, because tcheckbox.setdata ignore invalid data types , sets data false.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -