Recent

Author Topic: TBCButton border  (Read 4453 times)

fjabouley

  • Full Member
  • ***
  • Posts: 129
TBCButton border
« on: April 30, 2015, 10:58:45 am »
Hello all,
First of all, apologies for my English,
I got an issue with TBCButton, in fact, I can't get the border to be shown while the program is running, I can't also set the property "TBCbutton.StateNormal.Border.Style:=bboSolid;" It results with an error...
Could someone help me please ?
Thanks !

Josh

  • Hero Member
  • *****
  • Posts: 1463
Re: TBCButton border
« Reply #1 on: April 30, 2015, 02:34:09 pm »
Hi,

I have not checked, but you may need to add the unit BCTypes to your uses statement.

If I add a TBC Button to form ie BCButton1 with the BCTypes unit added, then the following works

BCbutton1.StateNormal.Border.Style:=bboSolid;

Hope that helps
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

lainz

  • Hero Member
  • *****
  • Posts: 4744
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: TBCButton border
« Reply #2 on: April 30, 2015, 06:48:27 pm »
josh is right, you need to add that unit. Is not added automatically.

fjabouley

  • Full Member
  • ***
  • Posts: 129
Re: TBCButton border
« Reply #3 on: April 30, 2015, 07:08:31 pm »
Thanks for your answers !
Now I don't get the error message while compiling.
But borders still aren't visible while I change the properties of TBCButtons on runtime.
If you have any ideas...
Thanks again !

Code: [Select]
for ci:=0 to componentcount-1 do begin
if (components[ci] is TBCButton)
then begin
if (skin=true) then begin;skinbutton((components[ci] as TBCButton));end;
end;

Code: [Select]
procedure skinbutton(AButton: tbcbutton);
begin
  with AButton do  begin
    memoryusage:=bmuhigh;
    globalopacity:=200;//
    Abutton.Rounding.RoundX:=0;
    Abutton.Rounding.RoundY:=0;
    with StateNormal do
    begin
 border.color:=clblack;
 border.Style:=bboSolid;
 border.Width:=1;
 border.ColorOpacity:=255;
      FontEx.Color := clwhite;
      Background.Gradient1.StartColor := clwhite; //RGBToColor(103, 103, 103);
      Background.Gradient1.EndColor := $00D3A274;//RGBToColor(103, 103, 103);
      Background.Gradient1EndPercent:=100;
      Background.Gradient2.StartColor := RGBToColor(103, 103, 103);   //103
      Background.Gradient2.EndColor := RGBToColor(80, 80, 80);        //71
    end;
    with StateHover do
    begin
      Border.Color := RGBToColor(24, 24, 24);
      FontEx.Color := clWhite;
      Background.Gradient1.StartColor := RGBToColor(200, 200, 200); //118
      Background.Gradient1.EndColor := RGBToColor(200, 200, 200); //118
      Background.Gradient2.StartColor := RGBToColor(200, 200, 200); //117
      Background.Gradient2.EndColor := RGBToColor(81, 81, 81);
    end;
    with StateClicked do
    begin
      Border.Color := RGBToColor(24, 24, 24);
      FontEx.Color := clWhite;
      Background.Gradient1.StartColor := RGBToColor(92, 92, 92);
      Background.Gradient1.EndColor := RGBToColor(92, 92, 92);
      Background.Gradient2.StartColor := RGBToColor(91, 91, 91);
      Background.Gradient2.EndColor := RGBToColor(62, 62, 62);
    end;
  end;
  end;

lainz

  • Hero Member
  • *****
  • Posts: 4744
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: TBCButton border
« Reply #4 on: April 30, 2015, 07:30:52 pm »
Thanks for your answers !
Now I don't get the error message while compiling.
But borders still aren't visible while I change the properties of TBCButtons on runtime.
If you have any ideas...
Thanks again !

Code: [Select]
for ci:=0 to componentcount-1 do begin
if (components[ci] is TBCButton)
then begin
if (skin=true) then begin;skinbutton((components[ci] as TBCButton));end;
end;

Code: [Select]
procedure skinbutton(AButton: tbcbutton);
begin
  with AButton do  begin
    memoryusage:=bmuhigh;
    globalopacity:=200;//
    Abutton.Rounding.RoundX:=0;
    Abutton.Rounding.RoundY:=0;
    with StateNormal do
    begin
 border.color:=clblack;
 border.Style:=bboSolid;
 border.Width:=1;
 border.ColorOpacity:=255;
      FontEx.Color := clwhite;
      Background.Gradient1.StartColor := clwhite; //RGBToColor(103, 103, 103);
      Background.Gradient1.EndColor := $00D3A274;//RGBToColor(103, 103, 103);
      Background.Gradient1EndPercent:=100;
      Background.Gradient2.StartColor := RGBToColor(103, 103, 103);   //103
      Background.Gradient2.EndColor := RGBToColor(80, 80, 80);        //71
    end;
    with StateHover do
    begin
      Border.Color := RGBToColor(24, 24, 24);
      FontEx.Color := clWhite;
      Background.Gradient1.StartColor := RGBToColor(200, 200, 200); //118
      Background.Gradient1.EndColor := RGBToColor(200, 200, 200); //118
      Background.Gradient2.StartColor := RGBToColor(200, 200, 200); //117
      Background.Gradient2.EndColor := RGBToColor(81, 81, 81);
    end;
    with StateClicked do
    begin
      Border.Color := RGBToColor(24, 24, 24);
      FontEx.Color := clWhite;
      Background.Gradient1.StartColor := RGBToColor(92, 92, 92);
      Background.Gradient1.EndColor := RGBToColor(92, 92, 92);
      Background.Gradient2.StartColor := RGBToColor(91, 91, 91);
      Background.Gradient2.EndColor := RGBToColor(62, 62, 62);
    end;
  end;
  end;
Check the bcbutton demo. Copy the button style that looks closer to yours and change it.
Sometimes border is not visible depending on other settings...

fjabouley

  • Full Member
  • ***
  • Posts: 129
Re: TBCButton border
« Reply #5 on: April 30, 2015, 10:42:49 pm »
Ok, I'll try that. That seemed weird to me because I could change other settings on runtime without any problem, except for border.
Thanks again for all!
Regards

lainz

  • Hero Member
  • *****
  • Posts: 4744
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: TBCButton border
« Reply #6 on: May 01, 2015, 12:26:24 am »
Ok, I'll try that. That seemed weird to me because I could change other settings on runtime without any problem, except for border.
Thanks again for all!
Regards

It works.
Try the code in bgracontrols\test\test_bccontrols\test_bccontrols

And you must set the border properties for each state, copy this inside StateNormal, StateHover and StateClicked

Code: [Select]
border.color:=clblack;
 border.Style:=bboSolid;
 border.Width:=1;
 border.ColorOpacity:=255; 

 

TinyPortal © 2005-2018