* * *

Author Topic: [SOLVED] Posible Bug  (Read 1765 times)

critter

  • New member
  • *
  • Posts: 13
Re: Posible Bug
« Reply #15 on: July 04, 2018, 01:50:30 pm »
Anyone can test if really in runtime changes the color assigned in design time?
Yes, I had to comment out // procedure SetOtherColor(AValue: TColor); because you haven't included it (are you sure you are recompiling the IDE?).

But when I drop a TestPanel on a form and change the PanelColor.Color in design-time to clRed, the caption turns red directly in the design-form. (I didn't need to move the panel this time for it to change)

the problem is in runtime

rvk

  • Hero Member
  • *****
  • Posts: 3462
Re: Posible Bug
« Reply #16 on: July 04, 2018, 01:54:01 pm »
the problem is in runtime
Then you need to provide an example because this works fine too:
Code: Pascal  [Select]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. begin
  3.   TestPanel1.PanelColor.Color := clYellow;
  4. end;

B.T.W. I take it FontColor is just an example because every TComponent (including TPanel) already has a TFont which you could use and which automatically redraws the complete component (with Invalidate internally).

critter

  • New member
  • *
  • Posts: 13
[SOLVED] Re: Posible Bug
« Reply #17 on: July 04, 2018, 02:21:01 pm »
I just solved it, and in case anyone needs it, the solution is to put the clause
"stored True" to the declaration of the subcomponent.

Code: Pascal  [Select]
  1.      property PanelColor:  TTestColor read FPanelColor stored True;  

Thank you all

Thaddy

  • Hero Member
  • *****
  • Posts: 6737
Re: [SOLVED] Posible Bug
« Reply #18 on: July 04, 2018, 02:29:09 pm »
That's what I expected  :D 8-)
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

Blaazen

  • Hero Member
  • *****
  • Posts: 2607
  • POKE 54296,15
    • Eye-Candy Controls
Re: [SOLVED] Posible Bug
« Reply #19 on: July 04, 2018, 03:12:34 pm »
I just solved it, and in case anyone needs it, the solution is to put the clause
"stored True" to the declaration of the subcomponent.

Code: Pascal  [Select]
  1.      property PanelColor:  TTestColor read FPanelColor stored True;  

Thank you all

Nonsense.
From Delphi manual:
Quote
If a property has no stored directive, it is treated as if stored True were specified.
It is the same in Lazarus. Adding "stored True" does nothing. It is still read-only property.

I just tried with TECSlider.Knob, which is also TPersistent descendant and this code:
Code: Pascal  [Select]
  1. property Knob: TECSliderKnob read FKnob stored True; //write FKnob;
  2.  
causes exactly the same troubles: design-time changes are not shown at run-time and property Knob is not in *.lfm at all.

My guess is that you do changes in your code and you don't reinstall the component properly - with absolutely necessary rebuild of whole Lazarus IDE.
Lazarus 2.1.0 r59015M FPC 3.3.1 r39660 x86_64-linux-qt Chakra, Qt 4.8.7/5.11.1, Plasma 5.13.4
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.14

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Thaddy

  • Hero Member
  • *****
  • Posts: 6737
Re: [SOLVED] Posible Bug
« Reply #20 on: July 04, 2018, 04:19:30 pm »
@Blaazen
Well, you have a lot more experience with writing components, for FPC that is... (you know I like and use them) but I have encountered this too and I am not a noob. Strange that this fixes it most of the time. Can still be a bug.
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

rvk

  • Hero Member
  • *****
  • Posts: 3462
Re: [SOLVED] Posible Bug
« Reply #21 on: July 04, 2018, 04:22:37 pm »
At least in trunk I didn't need to add the stored: True.
Maybe it's in certain circumstances that it happens.

Code: Pascal  [Select]
  1. object Form1: TForm1
  2.   Left = 256
  3.   Height = 240
  4.   Top = 210
  5.   Width = 320
  6.   Caption = 'Form1'
  7.   ClientHeight = 240
  8.   ClientWidth = 320
  9.   LCLVersion = '1.9.0.0'
  10.   object TestPanel1: TTestPanel
  11.     Left = 64
  12.     Height = 50
  13.     Top = 80
  14.     Width = 170
  15.     PanelColor.Color = clFuchsia
  16.     Caption = 'TestPanel1'
  17.   end
  18. end

Thaddy

  • Hero Member
  • *****
  • Posts: 6737
Re: [SOLVED] Posible Bug
« Reply #22 on: July 04, 2018, 04:41:29 pm »
That's my guess too, but I can not narrow it down. ( I use trunk as fresh milk:daily builds)
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

Blaazen

  • Hero Member
  • *****
  • Posts: 2607
  • POKE 54296,15
    • Eye-Candy Controls
Re: [SOLVED] Posible Bug
« Reply #23 on: July 04, 2018, 08:57:31 pm »
@ Thaddy:
Yes, it can be a bug. However, my suspicion is that original poster does not rebuild IDE properly(i.e. Package->Open Recent Package->Compile&Install). Then can easily happen that Lazarus does not reflect changes in code.

And the bug will come back when he will rebuild IDE in future.

Lazarus 2.1.0 r59015M FPC 3.3.1 r39660 x86_64-linux-qt Chakra, Qt 4.8.7/5.11.1, Plasma 5.13.4
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.14

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Windsurfer

  • Sr. Member
  • ****
  • Posts: 327
    • Windsurfer
Re: [SOLVED] Posible Bug
« Reply #24 on: July 04, 2018, 10:38:57 pm »
I think there is something wrong with the run time for Windows 10 and Linux Mint. Just drop a button on a form and try the following code with the button color set to cldefault in the object browser. Nothing changes with Laz 1.8.4 or 1.8.5 (fixes) on a 64 bit PC.

Code: Pascal  [Select]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. begin
  3.   Button1.color := clblue;
  4. end;
  5.  
  6. procedure TForm1.FormActivate(Sender: TObject);
  7. begin
  8.   Button1.Color := clAqua;
  9. end;
  10.  
  11. procedure TForm1.FormCreate(Sender: TObject);
  12. begin
  13.   Button1.Color := clRed;
  14. end;

rvk

  • Hero Member
  • *****
  • Posts: 3462
Re: [SOLVED] Posible Bug
« Reply #25 on: July 04, 2018, 11:13:40 pm »
Isn't TButton an OS component for which you can't change the color like that? It should always reflect the theme color. At least on Windows it's like that.

It's been discussed before and is not a.bug:
https://forum.lazarus.freepascal.org/index.php?topic=36774.0

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus