Adding declarations and definitions in the IDE for runtime components
I'm dealing with creating a number of components at runtime and setting their methods. Is there a way to add the declartion and definition stubs for a component without adding it to the form and clicking the corresponding event on the events tab?
I know I can add a component temporarily to create the stub, or sometimes the help files list the declaration. But there are a lot of features in the IDE that I have not found or used.
Replying to comments:
What I do currently is workable I just wondered if there was a shortcut I was missing. To reiterate as some did not understand; I am using component AwesomeComponent in my application. I only need to create instances of AwesomeComponent at runtime, so it is not on my form (or perhaps is non-visual). AmesomeComponent has an event DoSomething. That event has a number of parameters. In order to assign AmesomeComponent.OnDoSOmething at runtime, I need to code the event, but I don't have direct access to the procedure stub, I have to find it somewhere in documentation or create it on a dummy form to cut and paste it. I didn't know if there was an IDE feature that was smart enough to say "Ok, I recognize this name (AwesomeComponent.OnDoSOmething) as an event and create a stub for it. It must do essentially the same thing when double-clicking on the Events tab in the IDE.
delphi ide runtime declaration
|
show 4 more comments
I'm dealing with creating a number of components at runtime and setting their methods. Is there a way to add the declartion and definition stubs for a component without adding it to the form and clicking the corresponding event on the events tab?
I know I can add a component temporarily to create the stub, or sometimes the help files list the declaration. But there are a lot of features in the IDE that I have not found or used.
Replying to comments:
What I do currently is workable I just wondered if there was a shortcut I was missing. To reiterate as some did not understand; I am using component AwesomeComponent in my application. I only need to create instances of AwesomeComponent at runtime, so it is not on my form (or perhaps is non-visual). AmesomeComponent has an event DoSomething. That event has a number of parameters. In order to assign AmesomeComponent.OnDoSOmething at runtime, I need to code the event, but I don't have direct access to the procedure stub, I have to find it somewhere in documentation or create it on a dummy form to cut and paste it. I didn't know if there was an IDE feature that was smart enough to say "Ok, I recognize this name (AwesomeComponent.OnDoSOmething) as an event and create a stub for it. It must do essentially the same thing when double-clicking on the Events tab in the IDE.
delphi ide runtime declaration
What you mean? Say you create aTButton
at runtime and you want to set andEventHandler
to that button at design time? BTW without adding it to the form and... you mean aUnit
there instead ofForm
?
– Sami
Nov 19 '18 at 13:00
1
When you create a component at runtime, you need to assign his event handlers by coding it eg:Button.OnClick := ButtonOnClick;
– Sami
Nov 19 '18 at 13:08
1
What is wrong with creating the stub in the way you describe? You can always remove the link to your component later (and even remove the component) while keeping the code. It is as convenient as any alternative.
– Dsm
Nov 19 '18 at 13:42
If you mean: can I do in code what I normally do in the form designer? Yes, you can. You will have to add a runtime component to the form as parent and owner too, but not to the fields of the form class.
– Rudy Velthuis
Nov 19 '18 at 16:53
1
One approach is to put the components on a form you remove from the auto-create list. This lets you design them using the visual tools as much as you want and then instance them at runtime. Only need to add the form to the uses clause to get access to them.
– Brian
Nov 19 '18 at 19:20
|
show 4 more comments
I'm dealing with creating a number of components at runtime and setting their methods. Is there a way to add the declartion and definition stubs for a component without adding it to the form and clicking the corresponding event on the events tab?
I know I can add a component temporarily to create the stub, or sometimes the help files list the declaration. But there are a lot of features in the IDE that I have not found or used.
Replying to comments:
What I do currently is workable I just wondered if there was a shortcut I was missing. To reiterate as some did not understand; I am using component AwesomeComponent in my application. I only need to create instances of AwesomeComponent at runtime, so it is not on my form (or perhaps is non-visual). AmesomeComponent has an event DoSomething. That event has a number of parameters. In order to assign AmesomeComponent.OnDoSOmething at runtime, I need to code the event, but I don't have direct access to the procedure stub, I have to find it somewhere in documentation or create it on a dummy form to cut and paste it. I didn't know if there was an IDE feature that was smart enough to say "Ok, I recognize this name (AwesomeComponent.OnDoSOmething) as an event and create a stub for it. It must do essentially the same thing when double-clicking on the Events tab in the IDE.
delphi ide runtime declaration
I'm dealing with creating a number of components at runtime and setting their methods. Is there a way to add the declartion and definition stubs for a component without adding it to the form and clicking the corresponding event on the events tab?
I know I can add a component temporarily to create the stub, or sometimes the help files list the declaration. But there are a lot of features in the IDE that I have not found or used.
Replying to comments:
What I do currently is workable I just wondered if there was a shortcut I was missing. To reiterate as some did not understand; I am using component AwesomeComponent in my application. I only need to create instances of AwesomeComponent at runtime, so it is not on my form (or perhaps is non-visual). AmesomeComponent has an event DoSomething. That event has a number of parameters. In order to assign AmesomeComponent.OnDoSOmething at runtime, I need to code the event, but I don't have direct access to the procedure stub, I have to find it somewhere in documentation or create it on a dummy form to cut and paste it. I didn't know if there was an IDE feature that was smart enough to say "Ok, I recognize this name (AwesomeComponent.OnDoSOmething) as an event and create a stub for it. It must do essentially the same thing when double-clicking on the Events tab in the IDE.
delphi ide runtime declaration
delphi ide runtime declaration
edited Nov 20 '18 at 2:24
Ken White
107k11152314
107k11152314
asked Nov 19 '18 at 12:51


Aladdin
9415
9415
What you mean? Say you create aTButton
at runtime and you want to set andEventHandler
to that button at design time? BTW without adding it to the form and... you mean aUnit
there instead ofForm
?
– Sami
Nov 19 '18 at 13:00
1
When you create a component at runtime, you need to assign his event handlers by coding it eg:Button.OnClick := ButtonOnClick;
– Sami
Nov 19 '18 at 13:08
1
What is wrong with creating the stub in the way you describe? You can always remove the link to your component later (and even remove the component) while keeping the code. It is as convenient as any alternative.
– Dsm
Nov 19 '18 at 13:42
If you mean: can I do in code what I normally do in the form designer? Yes, you can. You will have to add a runtime component to the form as parent and owner too, but not to the fields of the form class.
– Rudy Velthuis
Nov 19 '18 at 16:53
1
One approach is to put the components on a form you remove from the auto-create list. This lets you design them using the visual tools as much as you want and then instance them at runtime. Only need to add the form to the uses clause to get access to them.
– Brian
Nov 19 '18 at 19:20
|
show 4 more comments
What you mean? Say you create aTButton
at runtime and you want to set andEventHandler
to that button at design time? BTW without adding it to the form and... you mean aUnit
there instead ofForm
?
– Sami
Nov 19 '18 at 13:00
1
When you create a component at runtime, you need to assign his event handlers by coding it eg:Button.OnClick := ButtonOnClick;
– Sami
Nov 19 '18 at 13:08
1
What is wrong with creating the stub in the way you describe? You can always remove the link to your component later (and even remove the component) while keeping the code. It is as convenient as any alternative.
– Dsm
Nov 19 '18 at 13:42
If you mean: can I do in code what I normally do in the form designer? Yes, you can. You will have to add a runtime component to the form as parent and owner too, but not to the fields of the form class.
– Rudy Velthuis
Nov 19 '18 at 16:53
1
One approach is to put the components on a form you remove from the auto-create list. This lets you design them using the visual tools as much as you want and then instance them at runtime. Only need to add the form to the uses clause to get access to them.
– Brian
Nov 19 '18 at 19:20
What you mean? Say you create a
TButton
at runtime and you want to set and EventHandler
to that button at design time? BTW without adding it to the form and... you mean a Unit
there instead of Form
?– Sami
Nov 19 '18 at 13:00
What you mean? Say you create a
TButton
at runtime and you want to set and EventHandler
to that button at design time? BTW without adding it to the form and... you mean a Unit
there instead of Form
?– Sami
Nov 19 '18 at 13:00
1
1
When you create a component at runtime, you need to assign his event handlers by coding it eg:
Button.OnClick := ButtonOnClick;
– Sami
Nov 19 '18 at 13:08
When you create a component at runtime, you need to assign his event handlers by coding it eg:
Button.OnClick := ButtonOnClick;
– Sami
Nov 19 '18 at 13:08
1
1
What is wrong with creating the stub in the way you describe? You can always remove the link to your component later (and even remove the component) while keeping the code. It is as convenient as any alternative.
– Dsm
Nov 19 '18 at 13:42
What is wrong with creating the stub in the way you describe? You can always remove the link to your component later (and even remove the component) while keeping the code. It is as convenient as any alternative.
– Dsm
Nov 19 '18 at 13:42
If you mean: can I do in code what I normally do in the form designer? Yes, you can. You will have to add a runtime component to the form as parent and owner too, but not to the fields of the form class.
– Rudy Velthuis
Nov 19 '18 at 16:53
If you mean: can I do in code what I normally do in the form designer? Yes, you can. You will have to add a runtime component to the form as parent and owner too, but not to the fields of the form class.
– Rudy Velthuis
Nov 19 '18 at 16:53
1
1
One approach is to put the components on a form you remove from the auto-create list. This lets you design them using the visual tools as much as you want and then instance them at runtime. Only need to add the form to the uses clause to get access to them.
– Brian
Nov 19 '18 at 19:20
One approach is to put the components on a form you remove from the auto-create list. This lets you design them using the visual tools as much as you want and then instance them at runtime. Only need to add the form to the uses clause to get access to them.
– Brian
Nov 19 '18 at 19:20
|
show 4 more comments
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53375036%2fadding-declarations-and-definitions-in-the-ide-for-runtime-components%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53375036%2fadding-declarations-and-definitions-in-the-ide-for-runtime-components%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What you mean? Say you create a
TButton
at runtime and you want to set andEventHandler
to that button at design time? BTW without adding it to the form and... you mean aUnit
there instead ofForm
?– Sami
Nov 19 '18 at 13:00
1
When you create a component at runtime, you need to assign his event handlers by coding it eg:
Button.OnClick := ButtonOnClick;
– Sami
Nov 19 '18 at 13:08
1
What is wrong with creating the stub in the way you describe? You can always remove the link to your component later (and even remove the component) while keeping the code. It is as convenient as any alternative.
– Dsm
Nov 19 '18 at 13:42
If you mean: can I do in code what I normally do in the form designer? Yes, you can. You will have to add a runtime component to the form as parent and owner too, but not to the fields of the form class.
– Rudy Velthuis
Nov 19 '18 at 16:53
1
One approach is to put the components on a form you remove from the auto-create list. This lets you design them using the visual tools as much as you want and then instance them at runtime. Only need to add the form to the uses clause to get access to them.
– Brian
Nov 19 '18 at 19:20