We help IT Professionals succeed at work.

just after properties assigned...

Igor UL7AAjr
Igor UL7AAjr asked
on
176 Views
Last Modified: 2010-04-04

What is the best way to do something with visual component just after it loaded and all of its property assigned? I mean overriding SetParent or something else.

Comment
Watch Question

Well, you dont say anything about what your are doing - e.g. design-time, run-time or component writing ??

Please give us some more details !!
Top Expert 2004

Commented:
? agreed with peter
Igor UL7AAjrSenior developer

Author

Commented:
More details.

I need to check and recalculate some properties of component. It must be done at design-time and run-time too. Text bellow is not exactly what I need but may be used as example:

type
   TMyComponent = class(TEdit)
     ...
     procedure CheckText;
  end;

procedure TMyComponent.CheckText;
begin
    if Text='' then
    begin
       Text:='some text';
       TWinControl(Parent).Width:=100;
    end;
end;

I would like to know: "Where the best place to call  procedure CheckText?". It's only sample. I only need to be sure that all properties of my component already assigned. Parent property -  for sample, it's optionally.
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
I think what you need is to assign your properties to procedures, like this :

type
TMyComponent = class(TEdit)
private
FMyText : string;
procedure FSetMyText(value : string);
public
 property MyText : string read FMyText write FSetMyText;

end;

procedure TMyComponent.FSetMyText(value : string);
begin
 if Value <>'' then
 begin
  FMyText:=Value;
  //or anything else you want to do
 end;
end;

Regards
Peter
Igor UL7AAjrSenior developer

Author

Commented:
It's exactly what I need. Usually, I do it overriding method SetParent, but one guy told me that it's not right way. How I can miss Loaded?...

Thanx
Igor.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.