Solved

Align : TAlign

Posted on 1998-10-01
9
615 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 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
 

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

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!

Question has a verified solution.

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

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

690 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