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
Post a Comment