TdfsIconComboBox and TdfsIconListBox v1.16 Description: A dropdown list style combobox that displays the icons that exist in a given file, and a listbox that displays the icons that exist in a given file, either horizontally or vertically. Features: Optionally, the control can disable itself when the filename is invalid. Optionally, the control can load icons "on demand." This speeds up the initialization process greatly because all icons do not have to be loaded when the control is created. Many file formats can be read from, including: .EXE, .DLL, .ICO .ICL { PCTools? Icon Library .NIL { Norton Icon Library ListBox can simulate a grid of icons, allowing you to set the number of icons to be displayed in both the X and Y direction. This setting can be changed dynamically. Contact Information: The lateset version will always be available on the web at: http://www.delphifreestuff.com If you have any questions, comments or suggestions, please use the Delphi Free Stuff Support Forum at: http://www.delphifreestuff.com/discus/ If, for some reason, you can not use the web-based support forum, you can email me at bstowers@delphifreestuff.com. However, the support forum will always take precedence over direct email since it provides a resource that others can use when they have a problem. Every message posted to the forum is emailed directly to this account, so emailing me directly will not get your message to me any faster. It will only make the message less important for me to respond to since only one person (you) is benefiting from it instead of everyone interested. Having said all that, please do email me directly if it is regarding something that isn't really support related, i.e. just to say thanks (as novel as that idea is). Installation: Delphi 1: * Select the 'Options | Install Components' menu item. * In the Install Components dialog, click the Add button. * In the Add Module dialog, enter the full path name of the component's registration unit (the unit that ends with 'Reg.pas', i.e. 'BrowseDrReg.pas') and click OK. * In the Add Module dialog, click OK. * The component library will be rebuilt and a new tab named 'DFS' will be available on the Component Palette. Delphi 2, C++Builder 1: * Select the 'Component | Install' menu item. * In the Install Components dialog, click the Add button. * In the Add Module dialog, enter the full path name of the component's registration unit (the unit that ends with 'Reg.pas', i.e. 'BrowseDrReg.pas') and click OK. * In the Add Module dialog, click OK. * The component library will be rebuilt and a new tab named 'DFS' will be available on the Component Palette. Delphi 3, 4, 5, C++Builder 3 & 4: * Do one of the following: + Create a new package by selecting File | New and choosing Package from the New tab in the dialog. + Open an existing package file. I suggest you do this if you already have a package that you like to use for small, third party components. I specifically have a package named "3rdParty.dpk" that I use for small components that come from other people. Or, if you are using several of my components, you might create a "DFS.dpk" package and use it for all of my DFS components. * In the resulting package window, click the Add button. * In the Add dialog, on the Add Unit tab, enter the full path name of the component's registration unit (the unit that ends with 'Reg.pas', i.e. 'BrowseDrReg.pas') and click OK. * You may want to add the other source files (*.pas) to the package as well in the same manner as you did the registration unit. While this is not required, not doing it will cause compiler warnings when the package is compiled. The component will function fine either way, but I personally find the warnings very irritating and am not happy until every compiler warning and hint is gone. * If this package is new, or it has never been installed, click the Install button in the package window. If this package is already installed in Delphi, click the Compile button. C++Builder 5 and up: * Perform the "Delphi 3 and up, C++Builder 3 and up" steps above, except for the last step (Compile or Install). * Select the package the component has been added to, and choose Project | Edit Option Source to open the package options in the editor. * In the entry for PFLAGS, add the "-LUvcl50" option. For example: * Perform the final step from above, Compile or Install. * For Borland's official word on this situation, open the C++Builder help file and search the index for "dsgnintf.dcu" and see the "Compiling packages with DsgnIntf" section. Delphi 6 and up: * Perform the "Delphi 3, 4, 5, C++Builder 3 & 4" steps above, except for the last step (Compile or Install). * Add the DesignIDE package to the Requires list of the package into which the component is being installed. * Perform the final step from above, Compile or Install. * This is necessary because of changes to the design-time support units introduced in Delphi 6. For complete information, see the Del6New.hlp file in your Delphi 6 Help directory. In the index, search for "upgrade issues" and in the resulting list of topics, select the "DsgnIntf renamed and related changes" topic. Notes: A note about TCustomComboBox (parent of TComboBox, and all combo descendants) and the owner drawn styles (csOwnerDrawFixed and csOwnerDrawVariable): TCustomComboBox has a design problem, in my opinion. The DropDownCount property is used to specify how many items are to be displayed when the ComboBox is "opened." This property works fine, as long as the size of what you are displaying is based on the font assigned to the control. If you look at the TCustomComboBox.AdjustDropDown method in the VCL source code (STDCTRLS.PAS), you will see that to calculate the size of the dropdown window, the DropDownCount property is multiplied by the height of the control's font. This is all well and good if what you are drawing is based on the font. In this case, however, we are drawing based on the size of an icon. The calculation should be based on DropDownCount and the ItemHeight property, IMHO. There are two ways that I can think of to work around this problem. 1) The simplest method is to just ensure that your Font.Height is equal to your ItemHeight. Note that you should probably use a TrueType font for Font.Name so that you can cover a wide range of sizes. 2) Fix the VCL source code so that it does the calculation properly. Known Issues: * There are no known issues at this time. TdfsIconComboBox Revision History: 1.16 + Updated for Delphi 6 compatibility. See updated install directions above. 1.15 + Updated for C++Builder 5 compatibility. 1.14 + It's *really* D5 compatible now. Small change between the D5 eval version and the real, shipping D5 version broke it. 1.13 + Wouldn't compile under D1, C1 or D2. Who knows how long it's been that way. 1.12 + Classname changed. + OnChange was not published. + D5 compatibility. 1.11 + Added IcCtlReg unit. All IDE specific code (i.e. registering the component, property editors, etc.) are contained in this unit. This was done for two primary reasons: 1) Using the component in a Delphi or C++Builder expert would register the component as well. 2) Reduce code size in some cases -- usually the smart linker removes this sort of stuff since the app never references it, but now it's for certain since it isn't even in the unit. This change means that you need to install the component using the new "registration" unit instead of the unit containing the component. 1.10: + Updated for Delphi 4 compatibility. 1.09: + Added public Icon property. This is useful for doing things like extracting and saving a specific icon. Note that the TIcon returned by this property is owned by the component; you should NEVER free it. 1.08: + Added Version property. 1.07: + Fixed nasty memory leak. 1.06: + Fixed problem with C++Builder 3 run-time packages. 1.05: + Updated for new DFS.INC file, component tab name, history/comments file. 1.04: + Small change for C++Builder compatibility. 1.03: + Resource for 16 and 32-bit version. This takes the place of a DCR file, which can't be compatible with both. See the $R directive below. To compile the resource file, use the following: Delphi 1: BRCC.EXE -foIconCtls.r16 -31 IconCtls.rc Delphi 2: BRCC32.EXE -foIconCtls.r32 -w32 IconCtls.rc 1.02: + Fixed problem under Delphi 2.0. 1.01: + Added read-only property: NumberOfIcons + Updated demo program to use NumberOfIcons and allow DropDownCount to be changed on the fly. + Added OnFileChange event. Useful for updating statics like Number of icons. 1.00: + Initial release TdfsIconListBox Revision History: 1.15: + Updated for C++Builder 5 compatibility. 1.14 + It's *really* D5 compatible now. Small change between the D5 eval version and the real, shipping D5 version broke it. 1.13 + Wouldn't compile under D1, C1 or D2. Who knows how long it's been that way. 1.12 + Classname changed. + Got rid of OnChange event. OnClick is the same thing. + D5 compatibility. 1.11 + Added IcCtlReg unit. All IDE specific code (i.e. registering the component, property editors, etc.) are contained in this unit. This was done for two primary reasons: 1) Using the component in a Delphi or C++Builder expert would register the component as well. 2) Reduce code size in some cases -- usually the smart linker removes this sort of stuff since the app never references it, but now it's for certain since it isn't even in the unit. This change means that you need to install the component using the new "registration" unit instead of the unit containing the component. 1.10: + Updated for Delphi 4 compatibility. 1.09: + Added public Icon property. This is useful for doing things like extracting and saving a specific icon. Note that the TIcon returned by this property is owned by the component; you should NEVER free it. + The following was done by Richard Fellner (r.fellner@xpoint.at): Even if there is enough space for all icons to display in a row, the component displays the white space for the scrollbar. Fixed. 1.08: + Added Version property. 1.07: + Fixed nasty memory leak. 1.06: + Fixed problem with C++Builder 3 run-time packages. 1.05: + Updated for new DFS.INC file, component tab name, history/comments file. 1.04: + Small change for C++Builder compatibility. 1.03: + Resource for 16 and 32-bit version. This takes the place of a DCR file, which can't be compatible with both. See the $R directive below. To compile the resource file, use the following Delphi 1: BRCC.EXE -foIconCtls.r16 -31 IconCtls.rc Delphi 2: BRCC32.EXE -foIconCtls.r32 -w32 IconCtls.rc 1.02: + Published Align property. + Fixed problem under Delphi 2.0. 1.01: + Added OnFileChange event. Useful for updating statics like Number of icons. + Fixed bug in ResetSize that caused width calculation to be incorrect. 1.00: + Initial release