Jump to content

Custom Components (UniLabel)


clovishulse

Recommended Posts

Hi.
 
I'm building custom components by adding UniLabel's to UniEdit, UniComboBox ...
I have similar components in VCL mode.
In the new components inherited from UniGui at design time the UniLabel components are shown correctly.
But at runtime the UniLabel components are not shown next to the UniEdit, UniComboBox ...
 
Can someone direct me so that I can evolve with this problem?
Are there any examples that might help me with this problem?
 
Thanks
 
 
Here are examples of source code:
 
unit CmpTest;


interface


uses
  Windows, Messages, Classes, Controls, uniGUIClasses, uniEdit, uniLabel, SysUtils;


type
  TCmpTest = class(TUniEdit)
  private
    FLabelCmp: TUniLabel;
    procedure SetLabelPosition;
  protected
    procedure SetParent(AParent: TWinControl); override;
    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
    procedure SetName(const Value: TComponentName); override;
    procedure CMVisiblechanged(var Message: TMessage); message CM_VISIBLECHANGED;
    procedure CMEnabledchanged(var Message: TMessage); message CM_ENABLEDCHANGED;
    procedure CMBidimodechanged(var Message: TMessage); message CM_BIDIMODECHANGED;
  public
    constructor Create(AOwner: TComponent); override;
    procedure SetBounds(ALeft: Integer; ATop: Integer; AWidth: Integer; AHeight: Integer); override;
  published
    property LabelCmp: TUniLabel read FLabelCmp;
  end;


procedure register;


implementation


constructor TCmpTest.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  if not Assigned(FLabelCmp) then
    begin
      FLabelCmp := TUniLabel.Create(Self);
      FLabelCmp.Parent := TWinControl(Self.Owner);
      FLabelCmp.FreeNotification(Self);
    end;
  SetLabelPosition;
end;

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...