[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Controlling properties of created components

Posted on 1997-08-22
1
Medium Priority
?
179 Views
Last Modified: 2013-11-23
Greetings,

I am a GUI/RAD beginner with knowledge of  OOP. I am writing a class that contains a TStringGrid component. In the constructor of that class, I create the object. Now, how do I create events for that component, if I cannot 'see' it at design time, so that the method pointer can be initialized? (Also, is it an acceptable practice to include VCL components inside of classes?) I currently have to include the component on the form, and in the constructor, I assign that instance to the class's declared one. This works fine, allowing me to assign events, but this seems  cumbersome. All comments are welcome! Thankyou.
0
Comment
Question by:Edo082297
1 Comment
 
LVL 4

Accepted Solution

by:
StevenB earned 240 total points
ID: 1342203
 Creating event handlers for the TStringGrid is pretty easy:

  Your components create procedure should include something like this:

  AGrid := TStringGrid.Create(AOwner);
  AGrid.Parent := AOwner;
  AGrid.OnClick := AGridClick // The Important line

  Then Simply define the AGridClick procedure as you would for any other event handler.

  From your question, I think this is the information you're after, however if you were actually asking how to declare new events, rather than handlers for existing events, then that's slightly more lengthy. I'll explain this procedure if you need, but I'm a bit short of time now. Leave a comment if you want more advice.

  As far as I'm concerned it's acceptable behavior to include VCL components within your own components, however I appreciate your concern. I always feal ever so slightly awkward about doing it. That said, I've been doing it for some time now and it's never caused any problems, so I reckon it's OK.

  Steven.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

834 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