Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 9 of 9 total
Thread Tag
Wed, Jan 28 2015 9:22 AMPermanent Link

Matthew Jones

I've just realised there is no Tag property for buttons, or anything
else. This is critical to arrays of components.

If possible, I'd really like a pointer and a string too, but Tag is a
show stopper for me.

I tend to use it for both basic stuff (like a calculator, so the Tag is
the number pressed), and advanced stuff, where a TPanel's tag indicates
the index into an array or list of items, so I can go from click to
data quickly.
Wed, Jan 28 2015 9:56 AMPermanent Link

Uli Becker

Matthew,

> I've just realised there is no Tag property for buttons, or anything
> else. This is critical to arrays of components.

A quick play with a TButton shows, that the property is there, but not
published.

Uli
Wed, Jan 28 2015 10:05 AMPermanent Link

Matthew Jones

Uli Becker wrote:

> A quick play with a TButton shows, that the property is there, but
> not published.

Phew! Yes, a quick check and it is in TComponent, public only.
Hopefully can be made published as standard.
Wed, Jan 28 2015 6:07 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< I've just realised there is no Tag property for buttons, or anything
else. This is critical to arrays of components. >>

Do you need it at design-time ?  I'm on the fence about having it available
at design-time....

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Jan 29 2015 4:23 AMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> Do you need it at design-time ?  I'm on the fence about having it
> available at design-time....

I've checked, and yes, I do. One thing I do is have a number of panels
and I animate between them using a tag set at run time. I use buttons
for option setting that use tags of 1, 2, 4, 8 to control flags. I have
some that are things like 6 too, to change two flags.

I could do it in code, but I'd rather not. The classic calculator
implementation depends on Tags.
Thu, Jan 29 2015 5:55 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< I've checked, and yes, I do. >>

I've changed this, but this is a good way to see how easy it is to modify
the component library:

1) In the WebCore unit, modify the TComponent component as follows and save
the changes:

  TComponent = class
     private
        FOwner: TComponent;
        FName: TComponentName;
        FData: TObject;
        FTag: Integer;
        FInitializing: Boolean;
        FDestroying: Boolean;
        FComponents: TObjectList;
        FNotifications: TObjectList;
        procedure SetDestroying;
        procedure SetName(const Value: TComponentName);
     protected
        procedure CheckOwnerClass(AOwnerClass: TClass);
        property Initializing: Boolean read FInitializing;
        procedure Initialize;
        procedure InitializeProperties; virtual;
        procedure Initialized; virtual;
        procedure NameChanged; virtual;
        procedure InsertComponent(Component: TComponent);
        procedure RemoveComponent(Component: TComponent);
        function GetComponentCount: Integer;
        function GetComponent(Value: Integer): TComponent;
        function Notification(Sender: TComponent; ID: Integer; Data:
TObject): Boolean; virtual;
        procedure Notify(ID: Integer; Data: TObject=nil); virtual;
     public
        constructor Create(AOwner: TComponent); virtual;
        destructor Destroy; override;
        property ComponentCount: Integer read GetComponentCount;
        property Component[Index: Integer]: TComponent read GetComponent;
        property Data: TObject read FData write FData;
        property Destroying: Boolean read FDestroying;
        property Owner: TComponent read FOwner;
        procedure Register(Component: TComponent);
        procedure UnRegister(Component: TComponent);
     published
        property Name: TComponentName read FName write SetName
           description 'Specifies the name of the component';
        property Tag: Integer read FTag write FTag default 0
           description 'Specifies an integer value to associate with the
component';
     end;

2) Select Library/Build and rebuild the component library.  Voila !  You
have a Tag property for all components at design-time.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Jan 29 2015 7:47 AMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> Matthew,
>
> << I've checked, and yes, I do. >>
>
> I've changed this, but this is a good way to see how easy it is to
> modify the component library:

I was thinking how I have custom changes in the current v1 library, but
of course there isn't that rebuild option, it needs the close of the
IDE.

But the much more interesting thought is whether I can have my custom
versions of the library in the path? Obviously I'd need to update them
when updating the IDE etc, but presumably I can have a custom WebCore
earlier in the path and never have to touch the standard one?
Thu, Jan 29 2015 8:11 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< I was thinking how I have custom changes in the current v1 library, but
of course there isn't that rebuild option, it needs the close of the IDE. >>

I don't quite understand that statement. Smile Do you mean EWB 1, or build 1
of the preview ?

EWB 2 can rebuild the component library at any time, and will pick up any
changes that you've made to the library search paths.  You don't even need
to close the current project - EWB will close it and then automatically
re-open it after the library is rebuilt.

<< But the much more interesting thought is whether I can have my custom
versions of the library in the path? Obviously I'd need to update them when
updating the IDE etc, but presumably I can have a custom WebCore earlier in
the path and never have to touch the standard one? >>

Yes, for the library just make sure that your custom path shows up before
the default library search path (Environment options dialog) and you'll be
all set.

Tim Young
Elevate Software
www.elevatesoft.com


Thu, Jan 29 2015 9:08 AMPermanent Link

Matthew Jones

I was meaning v1 of EWB. The flexibility of the new version is
excellent.
Image