Problem: What are Delphi and C++ Builder Action Lists and how do I use them? Solution: What are Action Lists? Action lists are a way of linking controls that perform similar tasks. Why use Action Lists? This is a time saver. Once controls are linked, changes made to an action list item will propagate to all components tied to that action item. Action List Demo Objective: To make the File | New command use an action list item Start New application Add MainMenu component to the form Double click MainMenu component — To import File Menu template Right click Form1.MainMenu Select Insert from Template Select File Menu Click OK Add ActionList component to the form Double click ActionList component This will display the Action List editor Click New Action — This action will be responsible for the New File Click Object Inspector Click Name Change to: actNewFile Click Caption Change to: &New Click Shortcut Change to: CTRL+N Double click MainMenu component Click Object Inspector Click Action Change to: actNewFile You can also use the down arrow to select this Go to Action List Editor Double click actNewFile Click Object Inspector Click Events tab This will display 3 properities: OnExecute, OnHint, & OnUpdate Double click OnExecute Enter ShowMessage(Create New File); Save All If we ran the application now, selecting File | New would trigger the message Create New File The benefit of saving time occurs when you have multiple components. Add Button component to the form Click Properties tab of the Object Inspector Click Action Change to: actNewFile — You can also use the down arrow to select this Add CheckBox component to the form Click Object Inspector Click Action Change to: actNewFile Doing the above will now tie the Button and CheckBox component properties to that action Run the application Change one line of code, save all, and then run the application again. That change will propagate to all components in the action list we created.
Last Modified: 24-OCT-00