Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread EWB2 and buttons
Sun, Feb 15 2015 8:12 PMPermanent Link

TD

Advanced Data Systems, Inc.

Just curious but can it create buttons of any size you wish?  

Thanks,
TD
Mon, Feb 16 2015 2:33 AMPermanent Link

Uli Becker

> Just curious but can it create buttons of any size you wish?

Yes, no problem. You can resize the button and change the font
properties as you want.

Uli
Mon, Feb 16 2015 5:53 AMPermanent Link

Godfrey

Ultimatesoft

Yes, no problem. You can resize the button and change the font
properties as you want.

Can you change the color of the button or is this controlled by a theme
Mon, Feb 16 2015 8:25 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Godfrey,

<< Can you change the color of the button or is this controlled by a theme
>>

First, you should watch the video that I just posted:

https://www.youtube.com/watch?v=dZEQBqP8NME

It explains how the controls work in relation to the control interfaces.

The *default* TButton uses a standard color that matches the "default"
interface that ships with EWB 2, and it cannot be changed because it needs
to be reversed, etc. for the various state changes.

If you want a different color button, then your options are:

1) Change the default TButton interface accordingly.  This works if you only
want to change the color/gradient colors and have them be the "new"
color/gradient colors.

2) Create a new TGodfreyButton control (just an example name) that simply
specifies a new interface class name to use, and then create a new interface
to use with this new class.

unit GodfreyButton_Unit;

interface

uses WebCore, WebUITypes, WebUI, WebCtrls;

type

  {$INTERFACE TGodfreyButton}

  TGodfreyButton = class(TButton)
     protected
        function GetInterfaceClassName: String; override;
     end;

implementation

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

end.

3) Create a new TColorButton control that descends from the TButtonControl
class and an associated interface that allows the background color to be
changed:

  {$INTERFACE TColorButton}

  TColorButton = class(TButtonControl)
     private
        FModalResult: TModalResult;
        function GetBackground: TBackground;  <<<<<<<<<<<<<<<<<<<<  This is
the key
     protected
        function GetInterfaceClassName: String; override;
        procedure InitializeProperties; override;
        function DoClick: Boolean; override;
     published
        property Top;
        property Left;
        property Height;
        property Width;
        property AlwaysOnTop;
        property Background: TBackground read GetBackground;  <<<<<<<<<
This is the key
        property Caption;
        property Constraints;
        property Cursor;
        property DisplayOrder;
        property Enabled;
        property Font;
        property Layout;
        property LayoutOrder;
        property Margins;
        property ModalResult: TModalResult read FModalResult write
FModalResult
           description 'Specifies the modal dialog result for the control';
        property TabOrder;
        property TabStop default True;
        property Tag;
        property Visible;
        property OnShow;
        property OnHide;
        property OnMove;
        property OnSize;
        property OnClick;
        property OnDblClick;
        property OnMouseDown;
        property OnMouseMove;
        property OnMouseUp;
        property OnMouseEnter;
        property OnMouseLeave;
        property OnEnter;
        property OnExit;
     end;

If you do 3), then you'll need to make sure that the control interface does
*not* try to apply the background property during state transitions.  Doing
so will cause your control's Background property settings to be overriden
when the mouse hovers over it, etc.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Dec 7 2015 10:23 PMPermanent Link

KimHJ

Comca Systems, Inc

<<"Tim Young [Elevate Software]" wrote:

3) Create a new TColorButton control that descends from the TButtonControl
class and an associated interface that allows the background color to be
changed:
 
function GetBackground: TBackground;  >>

Tim could you give me an example of what that function would look like, thanks?

Kim
Wed, Dec 9 2015 3:12 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Kim,

<< Tim could you give me an example of what that function would look like, thanks? >>

Sure, it would look like this:

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

Tim Young
Elevate Software
www.elevatesoft.com
Image