Search Results

Search found 4 results on 1 pages for 'smartins'.

Page 1/1 | 1 

  • Best way of storing an "array of records" at design-time

    - by smartins
    I have a set of data that I need to store at design-time to construct the contents of a group of components at run-time. Something like this: type TVulnerabilityData = record Vulnerability: TVulnerability; Name: string; Description: string; ErrorMessage: string; end; What's the best way of storing this data at design-time for later retrieval at run-time? I'll have about 20 records for which I know all the contents of each "record" but I'm stuck on what's the best way of storing the data. The only semi-elegant idea I've come up with is "construct" each record on the unit's initialization like this: var VulnerabilityData: array[Low(TVulnerability)..High(TVulnerability)] of TVulnerabilityData; .... initialization VulnerabilityData[0].Vulnerability := vVulnerability1; VulnerabilityData[0].Name := 'Name of Vulnerability1'; VulnerabilityData[0].Description := 'Description of Vulnerability1'; VulnerabilityData[0].ErrorMessage := 'Error Message of Vulnerability1'; VulnerabilityData[1]...... ..... VulnerabilityData[20]...... Is there a better and/or more elegant solution than this? Thanks for reading.

    Read the article

  • TToolButton Height Grows with Style = tbsDropdown

    - by smartins
    I noticed that the height of a TToolButton increases when you set the button's Style to tbsDropdown. I can understand the width increasing, so the button has space to draw the down arrow, but I'm not sure a height increase is necessary. Steps to reproduce the issue (Delphi 2010, Windows 7 x64): Add TToolbar to a form, ShowCaptions=True Right click to add a button to the Toolbar Set button Style=tbsDropDown and notice the button grows in height The same height increase happens when there are images assigned to the toolbar, in which case there is already plenty more vertical space available in the button to draw the drop down. Here's a visual example: Is there a workaround for this without hacking the VCL, or is this hardcoded into the Windows control?

    Read the article

  • Best way to create a collection of a class

    - by smartins
    I'm trying to create some classes that allow me to retrieve and manipulate a set of backups my application will create and manage. I've come up with the following code (not tested yet), but I'm not sure if it's the best way of accomplishing this or if there's any easier/better way. I'm using Delphi 2010. I have a class that holds the backup details (TBackupItem), then I need to have a class that will hold a collection of TBackupItem and finally I'll have a class that manages the reading and writing of backups and also exposes a property that accesses the collection of TBackupItem. type TBackupItem = class private FBackupProgram: string; FBackupProgramVersion: string; // There are more variables and properties but for the sake of simplicity I've listed only two public property BackupProgram: string read FBackupProgram write FBackupProgram; property BackupProgramVersion: string read FBackupProgramVersion write FBackupProgramVersion; end; TBackupsList = class(???) private // This class will hold a list of TBackupItem. What should I use to accomplish this? end; TBackupsManager = class(TObject) private FBackups: TBackupsList; public property Backups: TBackupsList read FBackups write FBackups; end; Do you guys have any comments and/or examples on the best way of accomplishing this? Thanks!

    Read the article

1