Forum > General

how to change color of a button

(1/6) > >>

frederic:
dear specialists

simple question...
following didn't work

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{ TForm1 } procedure TForm1.Button1Click(Sender: TObject);begin  button2.color:=clred;  button1.color:=cldefault;end; procedure TForm1.Button2Click(Sender: TObject);begin   button1.color:=clblue;    button2.color:=cldefault;end;                      
what is wrong with this

frederic

J-G:
Most annoying but the colour of a TButton is inherited and can't be changed - even though the object inspector makes it look as though it is a simple matter.

I resolved this by installing Jujibo components and then using TJButton which does have a modifyable colour attribute.

balazsszekely:
Hi Frederic,

TButton is just a wrapper around the standard OS button, therefor the color cannot be changed. Use a custom component instead.

Bart:
Or disable themes.

Bart

frederic:
thanks
 for the reactions,
i know what to do... when i have some time left

frederic

Navigation

[0] Message Index

[#] Next page

Go to full version