Solved

Align : TAlign

Posted on 1998-10-01
9
605 Views
Last Modified: 2012-06-27
I have tried to make a component that derived from TWinControl. And I add property Align, but it didn't work.
Why ?

Regards,
Joely
0
Comment
Question by:joely
9 Comments
 
LVL 7

Expert Comment

by:Motaz
ID: 1341407
What is the type of component ?
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1341408
joely

send you align code in for us to take a look at...

Later
BoRiS
0
 

Author Comment

by:joely
ID: 1341409
I just make procedure like this :

procedure SetAlign(Value : TAlign);
begin
  if FAlign <> Value then
  begin
    FAlign := Value;
    Invalidate;
  end;
end;

Joely
0
 

Accepted Solution

by:
chrismo earned 50 total points
ID: 1341410
The Align property is already created for you - it's just not published in TWinControl. You simply need to redeclare the property in the published section of your component - like TPanel:

extctrls.pas (if you have the VCL source)...

  TPanel = class(TCustomPanel)
  published
    property Align;
    ...
  end;
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:joely
ID: 1341411
Whereas I think TWinControl has this property but the descends from TWinControl can't use it automatically.
Why ?
Could you given me the reason ?
Or I have to make the procedure self like in extctrls.pas

Regards Joely
0
 

Expert Comment

by:chrismo
ID: 1341412
If I understand you correctly, you said descendants from TWinControl can't use the Align property automatically. I'm not sure why this would be the case.

Again, TPanel descends from TCustomPanel -- TCustomControl -- TWinControl. I don't see any code in these descendants that do anything special - TPanel merely exposes the Align property.

Make sure you are not redefining the entire Align property and field. If you are doing this:

TMyClass = class(TWinControl)
private
  FAlign: TAlign;
  ...
published
  property Align read FAlign write SetAlign;
end;

. then you are overwriting the inherited field and property and it won't work. To use the inherited stuff, you should not define your own field, and do not fully define the property - as follows (refer to TPanel source in VCL if you have it):

TMyClass = class(TWinControl)
private
  // don't put anything here for Align - it's inherited
published
  property Align; // this will merely use the inherited property
  //property Align read FAlign write SetAlign; don't use this!
end;
0
 

Author Comment

by:joely
ID: 1341413
Yes, that's right.
And I also try with color, but how with Caption.
I have still make procedure self.
Thanks.

Regards Joely
0
 

Expert Comment

by:chrismo
ID: 1341414
This one's a bit more complicated - I don't have the time right now to answer in - check out the VCL source if you have it - TControl.GetText and .SetText. Ask a new question to get this one answered
0
 

Author Comment

by:joely
ID: 1341415
Ok, Thanks.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
loading dll from external path 1 198
Downloading email attachments 2 55
LAN or WAN ? 11 66
Convert MS Word document to a PDF file 9 33
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now