Skip to content

Could move the FWords: TWordsCollection; to be a protected member of TSkLabel?  #370

@wqmeng

Description

@wqmeng

Could move the FWords: TWordsCollection; to be a protected member of TSkLabel?

Recently I would like to add the onMouseOver, onMouseLeave, onMouseEnter event to the TCustomWordsItem object, and I extend the TCustomWordsItem, And also create a TSkLabelEx class to extend the TSkLabel class.

Then override the function of the TSkLabel class in TSkLabelEx to support the worditem event the mouseOver, MouseEnter, MouseLeave. Now the only matter is the FWords: TWordsCollection which is a private member and can not accessed by my sub-class, So the first word item will not be changed to be my TCustomWordsItemEx object which can not handle the mouseEvent.

Thank you.

constructor TSkLabelEx.Create(AOwner: TComponent);
begin
  inherited;
  FWords.Free;
  FWords := TWordsCollection.Create(Self, TCustomWordsItemEx);
//  Words.set
  FWords.OnChange := WordsChange;
end;

The FWords can not access, and if changed to Words.Free, Words := TWordsCollection.Create(Self, TCustomWordsItemEx); The FWords.Assign function will fail too as the FWords are already freed. If do not free the old FWords, the first WordItem will always be TCustomWordsItem instead of TCustomWordsItemEx .

I want to change the default FWords to be a TWordsCollection of my sub-class TCustomWordsItemEx which add the mouse Event support.

Thank you.

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy