Recent

Author Topic: [SOLVED] Suppress the colordialog displaying for a TColorButton  (Read 349 times)

petevick

  • Sr. Member
  • ****
  • Posts: 427
[SOLVED] Suppress the colordialog displaying for a TColorButton
« on: February 01, 2026, 05:02:22 pm »
Is there any way to prevent the ColorDialog displaying for a TColorButton in it's onclick event ?
« Last Edit: February 01, 2026, 05:20:30 pm by petevick »
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Windows 10, Lazarus 3.2, FPC 3.2.2

jamie

  • Hero Member
  • *****
  • Posts: 7602
Re: Suppress the colordialog displaying for a TColorButton
« Reply #1 on: February 01, 2026, 05:06:45 pm »
Supply the ColorDialog Property with a fake one?

Jamie
The only true wisdom is knowing you know nothing

petevick

  • Sr. Member
  • ****
  • Posts: 427
Re: Suppress the colordialog displaying for a TColorButton
« Reply #2 on: February 01, 2026, 05:10:39 pm »
Supply the ColorDialog Property with a fake one?

Jamie
Unfortunately that gives an "Invalid property value" error
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Windows 10, Lazarus 3.2, FPC 3.2.2

jamie

  • Hero Member
  • *****
  • Posts: 7602
Re: Suppress the colordialog displaying for a TColorButton
« Reply #3 on: February 01, 2026, 05:17:37 pm »
Ok, this do this instead.

in the OnClick Event use "Abort", that will skip it.

Jamie
The only true wisdom is knowing you know nothing

petevick

  • Sr. Member
  • ****
  • Posts: 427
Re: Suppress the colordialog displaying for a TColorButton
« Reply #4 on: February 01, 2026, 05:20:11 pm »
Ok, this do this instead.

in the OnClick Event use "Abort", that will skip it.

Jamie
You Sir are my hero, I was trying Exit without success !
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Windows 10, Lazarus 3.2, FPC 3.2.2

wp

  • Hero Member
  • *****
  • Posts: 13418
Re: [SOLVED] Suppress the colordialog displaying for a TColorButton
« Reply #5 on: February 01, 2026, 05:32:35 pm »
What are you trying to achieve? Without the ColorDialog you cannot change the color - the TColorButton is useless then. Or do you just want to display a color? Use a TShape or a TPanel instead.

petevick

  • Sr. Member
  • ****
  • Posts: 427
Re: [SOLVED] Suppress the colordialog displaying for a TColorButton
« Reply #6 on: February 01, 2026, 05:37:08 pm »
What are you trying to achieve? Without the ColorDialog you cannot change the color - the TColorButton is useless then. Or do you just want to display a color? Use a TShape or a TPanel instead.
In certain situations I don't want the color dialog displayed, disabling the button would probably be the user friendly route but I have a lot of TColorbuttons, over 50 of of them !! so I'm just working on the best way to 'disable' the TColorButton.
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Windows 10, Lazarus 3.2, FPC 3.2.2

jamie

  • Hero Member
  • *****
  • Posts: 7602
Re: [SOLVED] Suppress the colordialog displaying for a TColorButton
« Reply #7 on: February 01, 2026, 05:39:53 pm »
That control has animated button action and if you still want to use the OnClick for some processing, you can. Simply use "Abort" before it exits and the internal Dialog wont popup.

 I find a few controls in the system that are like that via the OnClick where you can have the default action get ignored. I am not an advocate of using try ... Except/Finally all over the place but it works out there.

Jamie
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018