TColorBox AddItem lazarus / 31-LCL ---------------------------------------------------------------------- PaulANormanNZ · 2018-03-20 11:50 Hi I'm having the same problem as has been struvk in the Rusian Forum http://freepascal.ru/forum/viewtopic.php?f=5&t=10379 QuoteRxDBColorBox1.Items.AddObject('SOmeName',TObject(StringToColor('c lRed'))); gives an error Error: Illegal type conversion: "TGraphicsColor" to "TObject" I'm on 1.8.0 FPC 3.0.4 64bit Windows 8.1 Pro Is tobject(ptrint(intptr(Acolor:Tcolor))) a good solution? TIA Paul ---------------------------------------------------------------------- taazz · 2018-03-20 14:17 To quote system.pas QuoteCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   IntPtr  = PtrInt;  so that is a double cast in to the same type just use one them. ---------------------------------------------------------------------- PaulANormanNZ · 2018-03-24 03:38 Thanks for that, why do we need to use any of them - is this a bug? Paul ---------------------------------------------------------------------- taazz · 2018-03-24 04:19 Quote from: PaulANormanNZ on March 24, 2018, 04:38:44 amThanks for that, why do we need to use any of them - is this a bug? No its not a bug, it is type safety. The compiler does not know how to cast TColor to a pointer directly so casting it as an integer helps the transition. ---------------------------------------------------------------------- PaulANormanNZ · 2018-03-24 09:21 Apparently  Lazarus/32bit does not do this, it only happens with 64bit. ---------------------------------------------------------------------- Thaddy · 2018-03-24 09:23 Quote from: PaulANormanNZ on March 24, 2018, 10:21:14 amApparently  Lazarus/32bit does not do this, it only happens with 64bit. What?!? Confused. There is no difference. ---------------------------------------------------------------------- PaulANormanNZ · 2018-03-24 09:36 Thanks Thaddy,, This is what the Russian guys reported as shown in the link earlier in the thread - Google Translated :-) ... QuoteGood day. It will be confronted with the fact that in the 64-bit version of lazarus the expression is of the type: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i RxDBColorBo x1.Items.AddObject('Красный',TObject(StringToColor('clRed'))); gives an error Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Error: Illegal type conversion: "TGraphicsColor" to "TObject" but at the same time in 32 bit it works without problems. What is it? Paul ---------------------------------------------------------------------- zeljko · 2018-03-24 13:59 Quote from: PaulANormanNZ on March 24, 2018, 10:21:14 amApparently  Lazarus/32bit does not do this, it only happens with 64bit. Have you tried TObject(PtrUInt(MyColor)) ? ---------------------------------------------------------------------- taazz · 2018-03-24 14:15 Quote from: PaulANormanNZ on March 24, 2018, 10:36:38 amThanks Thaddy,, This is what the Russian guys reported as shown in the link earlier in the thread - Google Translated :-) ... QuoteGood day. It will be confronted with the fact that in the 64-bit version of lazarus the expression is of the type: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i RxDBColorBo x1.Items.AddObject('Красный',TObject(StringToColor('clRed'))); gives an error Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Error: Illegal type conversion: "TGraphicsColor" to "TObject" but at the same time in 32 bit it works without problems. What is it? Paul TColor is a 32bit integer while ptrint/ptruint and pointer changes size from 32 to 64bit.