[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Controlling properties of created components

Posted on 1997-08-22
1
Medium Priority
?
176 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
[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
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

649 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