Im using Delphi 5 and I'm creating a number of panels at runtime, then creating buttons on the panels, obviously again at runtime. I need to do it this way because I may need to dynamically create more panel/button combinations in the future.
I can do all of this, but I'm at a loss as to how to reference the panels I've created, because I can't find a way to access the panels' component name. Hunting around the Internet I've found that I can use FindComponent to find the panel components by name, but I still don't know how to use that name, because I can't use a string variable to refer to it - e.g. StringVar := Panel.Name. I get a type mismatch, TComponentName versus String.
I've read on several forums (including this one) that there is no way to reference the panels by name directly. I've tried using a component array, but I strike the same problem - I need to refer to the component by its assigned component name.
You're conflating the component name with the variable name. The Delphi IDE strives to keep those two the same, for IDE-created components, but they're not necessarily equal. You don't have variable names because you're creating the components dynamically, and you don't know how many variables you'd need. However, you still have control over the component names: Simply assign the Name property of the component, and then you can use it the same way you use any other component names, by calling FindComponent. Just make sure the names are unique for each panel instance.
Remember also that the way to deal with variables, when you don't know at compile time how many you'll need, is to use arrays or lists. You can use plain old arrays, or you can use a more sophisticated data structure like TComponentList or TDictionary.
Finally, to make it easier to refer to the controls on the panels you're creating, you can dispense with the panels and use frames instead. You can visually design a TFrame in the IDE and give names to the buttons, and at run time, you can instantiate the frame class, and it will automatically create all the buttons for you, just like when you instantiate a form or data module. You only need to give a name to the new frame object, but that object will already have named fields referring to the buttons.
will change all Captions of tPanels in your application. In order to distinguish between Panels created by code and designer you can use the TAG property of each created tPanel and use it in the above example.
What's the best way to solve this? I thought about adding the "found" components to a standalone array, and then walk through that after this loop to delete them, which I think will work.... but is that the best approach?
It may not happen in your case, but the if frmMain.Components[i] is TMyClass check will also return true for descendant classes of TMyClass. If you are really looking for the removal of one specific class, you may need to add an extra check of the ClassName.
For now, a fellow member of this community has posted a workaround, although SAP cannot officially support it: -
engineering.de/ads-and-delphi-10-2-tokyo/. I am not sure whether the workaround will work for ADS 11.
DevExpress VCL components are feature-complete and built for speed regardless of data complexity or size. DevExpress VCL components are reliable and well tested so that mission critical applications behave as expected, each and every time.
DevExpress data-aware controls are powered by our legendary server-side data processing engine so that users can shape and analyze information at lightning speeds, without sacrificing features or capabilities. Because of our tireless commitment to performance, reliability and technological innovation, you can confidently build data-centric applications that amaze, be it financial trading applications using real-time feeds or information driven enterprise-grade business intelligence solutions.
With dozens of high-performance VCL components, the DevExpress VCL Subscription helps you deliver compelling, easy-to-use business solutions fast. Emulate the look, feel and capabilities of Microsoft Office or replicate the dock-based UI of Visual Studio or Adobe Photoshop and take your Delphi and C++Builder applications to an entirely new level with familiar features end-users have come to rely upon. It's everything you need to build your best in one integrated suite.
And because technology never stands still, DevExpress continues to release innovative, high-impact components for the VCL such as the Tile Control, Adorner Manager, Camera Control and Barcode Control, allowing your UI to easily evolve without abandoning your existing codebase or the proven VCL platform.
The DevExpress VCL Subscription includes dozens of high-performance user interface components for next-gen decision support systems. Whether you need to build a fully customizable analytics dashboard or incorporate Excel-like pivot tables, this subscription has everything you'll need to create apps that inform and engage.
The DevExpress VCL product line allows you to create applications that emulate the touch-first experience that lies at the heart of Windows 10, without abandoning your existing VCL investments. Whether you need to create a tile-based modern UI application for Windows 10, or need to quickly convert an existing project to a Microsoft Surface touch-first application, the DevExpress VCL Subscription will help you take your business solutions forward so you can deliver new, immersive experiences to delight your users.
The most popular data grid for the VCL platform is only available from DevExpress. From standard two-dimensional tables to runtime grouping and column customization; from master-detail relationships to card views; from integrated themes to unbound mode... The DevExpress VCL Grid Suite is the industry standard, without equal in the marketplace. Read about VCL Data Grid
DevExpress VCL Subscriptions ship with a localization component and a standalone Localizer Application, which allows end-users to generate translations for individual components. A number of ready-to-use translations have been published and can be downloaded via the DevExpress Support Center.
Search the Support Center
From masked data input and built-in data validation to HTML formatting, the VCL Data Editors Library offers unmatched data editing options whether used for standalone data editing or as cell editors in container controls like the DevExpress VCL Data Grid.
Read about VCL Data Editors
We are so confident in our products and services that we back them with a 60 day no questions asked money back guarantee. If within the first 60 days of ownership you are not satisfied with the capabilities of our tools, you can request a full refund of the amount you paid to DevExpress by writing to
clients...@devexpress.com or by calling
+1 (818) 844-3383.
DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, Delphi, HTML5 or iOS & Android development. Whether using WPF,
ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.
In the course of some project analysis, it has become apparent that we would benefit from exporting a list of all installed components in Delphi. I have found articles discussing how to obtain the list using the ToolsAPI, but that would mean building a package for a wizard, which is more of a side project than I was seeking.
As it happens, I need to run in XE7, where the key is this: HKEY_CURRENT_USER\Software\Embarcadero\BDS\15.0\ToolForm\Mapping. I also have an interest, though no absolute need, to run this in D2007, but I find no entry in the registry for such information. Has anyone committed a web page on the variations of such content in different versions?
Which code? You posted code for use in a package. I am now scanning the registry, and collecting from there with my own code, which works fine, though there are a few idiosyncrasies in the lists there.
The point of my last post, though, was that although the registry scan is convenient, it is specific right now to XE7. And given the minor irregularities I have found in the entries there, it seems reasonable to anticipate irregularities in other versions, whether the same or different to these. In D2007, however, I find no evidence of installed components in the registry, so in the end, the ToolsAPI may be the only reliable approach.
Software components and controls are pre-built software libraries that you can use in your application to add new functionality. By adding functionality written by experts, you are not only saving time and effort but also adding high quality features to your application - fast.
Description: All the Developer Express VCL products in one package. Developer Express VCL Subscription includes VCL components for: data entry, charting, data analysis, navigation, layout, grids, scheduling, styling, reporting, printing and planning. Developer Express ... Read more
Description: Communications, security and e-business components. /n software Red Carpet Subscription includes every edition of every product /n software offer in a frequently updated subscription service. You get tools for every major communications and security ... Read more
Description: Stay up to date with all RemObjects products for your platform. RemObjects Suite Subscription for Delphi offers a convenient and cost effective way to stay up-to-date with all RemObjects Delphi products. It grants you access to all current and upcoming ... Read more
Description: Reporting and document creation VCL library for Delphi, C++Builder, RAD Studio and Lazarus. FastReport VCL is an add-on component that allows your application to generate reports quickly and efficiently. FastReport provides all the necessary tools to ... Read more
Description: A library of components that provides direct access to multiple databases from Delphi and C++Builder. Universal Data Access Components (UniDAC) is a library of components that provides direct access to multiple databases from Delphi and C++Builder, as ... Read more
3a8082e126