Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Align : TAlign

Posted on 1998-10-01
9
Medium Priority
?
617 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Accepted Solution

by:
chrismo earned 150 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
 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

597 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