Colors set as constants in program are permanent lazarus / 39-Graphics ---------------------------------------------------------------------- jdlinke · 2014-06-13 03:08 I was attempting to have some color templating capability in my new project, so I set aside a unit for gui-related constants to be shared among my form. I added some new colors as constants. I thought I would be able to change them, but now no matter what value I set, the original colors I set remain when I run my program. I even tried completely closing Lazarus and reopening my project. Also, I get the same result whether I run from IDE or directly from the .exe. Here's the unit in which I defined my new colors: Code: [Select]unit unitDefinitions; {$mode objfpc}{$H+} interface uses   Classes, SysUtils, Graphics; const   // Use the 'mono' on following site to help with scheme:   // http://colorschemedesigner.com/   cllbLightest = TColor($FFA4A4);   cllbLight = TColor($FF8383);   cllbMedium = TColor($FF5959);   cllbDark = TColor($BF6262);   cllbDarkest = TColor($A61D1D); implementation end. Am I doing something wrong? How can I fix this? The gaudy purple tones I originally chose are driving me up the wall! Running Lazarus 1.2.2 on Windows 8.1 ---------------------------------------------------------------------- Windsurfer · 2014-06-13 05:40 This may be a 'Doh' moment for you, constants do not change. Use variables. ;o) ---------------------------------------------------------------------- Blaazen · 2014-06-13 06:17 Initialized variables can do the job: Code: [Select]var   Color: TColor = $4455FF; ---------------------------------------------------------------------- howardpc · 2014-06-13 06:59 Or use typed constants: Code: [Select]{$J+} const   cllbLightest = TColor($FFA4A4);   ... ---------------------------------------------------------------------- taazz · 2014-06-13 07:01 Quote from: howardpc on June 13, 2014, 08:59:51 amOr use typed constants: Code: [Select]{$J+} const   cllbLightest = TColor($FFA4A4);   ... that is a writable const this is a typed const Code: [Select]const   cllbLightest :TColor = $FFA4A4; ---------------------------------------------------------------------- Blaazen · 2014-06-13 07:30 AFAIK there's no practical difference between: Code: [Select]var   Color: TColor = $4455FF; and Code: [Select]const   Color: TColor = $4455FF; ---------------------------------------------------------------------- taazz · 2014-06-13 07:35 Code: [Select]procedure Test; {J+} const  MyValue : Byte = 0; begin   writeln(myValue);   myvalue := myvalue +1; end; begin   test;   test;   test; end; that can not be done with a variable; ---------------------------------------------------------------------- Leledumbo · 2014-06-13 07:48 Quote from: Blaazen on June 13, 2014, 09:30:37 amAFAIK there's no practical difference between: Code: [Select]var   Color: TColor = $4455FF; and Code: [Select]const   Color: TColor = $4455FF; Except if it's a local declaration ---------------------------------------------------------------------- circular · 2014-06-13 10:16 Well anyway if you want to change it, you better declare it as "var", because you never know what implementation you will have. Using "const" and changing it is not guaranteed to work all the time.