Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread button color?
Thu, Mar 16 2017 9:54 AMPermanent Link

kamran

Hi

Will that eventually be a new feature of EWB 2.06 ? ( i don't have 2.06 beta so not sure if it is there already or not!)

I guess that would be a great UI feature to have for everyone here.

Regards

Kamran
Thu, Mar 16 2017 1:17 PMPermanent Link

Uli Becker

Fri, Mar 17 2017 7:54 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Kamran,

<< Will that eventually be a new feature of EWB 2.06 ? ( i don't have 2.06 beta so not sure if it is there already or not!) >>

No.  This question gets asked a lot, and the quick answer is that you can't allow for the TButton control interface to use background fill colors for its various states if you allow for the button's background fill color to be specified in the control itself.  So, I chose to not allow it.

There are very easy ways to get around this, the least of which is this:

1) Create the following unit and save it as ColorButton.wbs in the location of your choosing:

unit ColorButton;

interface

uses WebCore, WebUI, WebCtrls, WebBtns;

type

  {$INTERFACE TColorButton}

  TColorButton = class(TButton)
     private
        function GetBackground: TBackground;
     protected
        function GetInterfaceClassName: String; override;
     published
        property Background: TBackground read GetBackground
           description 'Specifies the background for the control';
     end;

implementation

function TColorButton.GetInterfaceClassName: String;
begin
  Result:=TColorButton.ClassName;
end;

function TColorButton.GetBackground: TBackground;
begin
  Result:=Element.Background;
end;

end.

2)  Copy the TButton.wbi control interface to a new name, TColorButton.wbi, and in the same location where you saved the ColorButton.wbs unit.

3) Open the TColorButton.wbi control interface in the IDE, change its class name to TColorButton, and then modify the various states as necessary. At the very least, in order to turn off the background from changing between states, make sure that each state has its ApplyProperties.Background set to False.

4) Use the Library/Add Component option to add the control to the component library:

Name=TColorButton
Unit File=<Full path location of ColorButton.wbs that you saved earlier>

Leave the rest alone for now, and click on OK to add the component.

That's it, you now have a button control whose background you can change.

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Mar 17 2017 9:07 AMPermanent Link

kamran

Thanks Tim and Uli

I will follow that up.

Cheers

Kamran

Tim Young [Elevate Software] wrote:

Kamran,

<< Will that eventually be a new feature of EWB 2.06 ? ( i don't have 2.06 beta so not sure if it is there already or not!) >>

No.  This question gets asked a lot, and the quick answer is that you can't allow for the TButton control interface to use background fill colors for its various states if you allow for the button's background fill color to be specified in the control itself.  So, I chose to not allow it.

There are very easy ways to get around this, the least of which is this:

1) Create the following unit and save it as ColorButton.wbs in the location of your choosing:

unit ColorButton;

interface

uses WebCore, WebUI, WebCtrls, WebBtns;

type

  {$INTERFACE TColorButton}

  TColorButton = class(TButton)
     private
        function GetBackground: TBackground;
     protected
        function GetInterfaceClassName: String; override;
     published
        property Background: TBackground read GetBackground
           description 'Specifies the background for the control';
     end;

implementation

function TColorButton.GetInterfaceClassName: String;
begin
  Result:=TColorButton.ClassName;
end;

function TColorButton.GetBackground: TBackground;
begin
  Result:=Element.Background;
end;

end.

2)  Copy the TButton.wbi control interface to a new name, TColorButton.wbi, and in the same location where you saved the ColorButton.wbs unit.

3) Open the TColorButton.wbi control interface in the IDE, change its class name to TColorButton, and then modify the various states as necessary. At the very least, in order to turn off the background from changing between states, make sure that each state has its ApplyProperties.Background set to False.

4) Use the Library/Add Component option to add the control to the component library:

Name=TColorButton
Unit File=<Full path location of ColorButton.wbs that you saved earlier>

Leave the rest alone for now, and click on OK to add the component.

That's it, you now have a button control whose background you can change.

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Mar 17 2017 9:39 AMPermanent Link

kamran

Hi Tim

So following on from that !

Ok.. so how about if buttons were allowed colored borders as in "Grid" and "Panel" component.

That would work for me!

Regards

Kamran


No.  This question gets asked a lot, and the quick answer is that you can't allow for the TButton control interface to use background fill colors for its various states if you allow for the button's background fill color to be specified in the control itself.  So, I chose to not allow it.
<< Will that eventually be a new feature of EWB 2.06 ? ( i don't have 2.06 beta so not sure if it is there already or not!) >>
Fri, Mar 17 2017 9:49 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Kamran,

<< Ok.. so how about if buttons were allowed colored borders as in "Grid" and "Panel" component. >>

Same process, just use the Border property/getter like the Background property, and be sure to clear the ApplyProperties.Border property from each control interface state.

Tim Young
Elevate Software
www.elevatesoft.com
Image