n7800, I have a question for you if I may please. In the packageeditor.pas how does one get a form to display when a menu item is clicked? I have managed to get the ShowMessage dialog working but I need to display a from that has our icon stuff in it like the option to select between the .lrs legacy format or the .res newer format. If anyone out there knows please show me how!
As usual,
search for something similar in the IDE, look at the code and repeat ))
If I understood the question correctly, then as a quick answer, I can suggest looking at the "
Add" drop down button, and its "
New Component" command. It also shows a window for creating a component.
As you can see, the button click event
mnuAddNewCompClick calls
ShowNewCompDialog method, which calls the global function
ShowAddToPackageDlg from another unit
addtopackagedlg.pas, which contains the required form.
In it, this form is
created and called as a modal. It can do something or return some data (like
fParams here), after which the form is freed and control is returned to the button.
This is how almost all dialog windows (
modal) in the IDE are designed. In fact, they work as a function that returns data from a window (which is created just like a regular class).
Of course, functions like
ShowAddToPackageDlg are created simply to reduce code duplication. The form can be created and called directly in the button event.
As far as I can see, the "extra"
ShowNewCompDialog method in this chain is created here because it is called from another unit too.
I recommend always studying the places where variables/methods are used by searching in files
[Ctrl+Shift+F]. Such a simple text search gives a lot of unnecessary results (since it does not take into account the visibility of variables), but it usually helps a lot.