Delphi は、長年にわたって多数の機能を導入してきました。RAD Studio の新しいバージョンがリリースされるたびに、新しい機能セットも導入されます。ただし、利用可能な機能が圧倒的に多いため、一部のコンポーネントは忘れられたり、誤用されたり、その可能性を最大限に発揮できなかったりしています。例えば、TActionは長い間 Delphi に存在します。これらの非ビジュアル コンポーネントは Delphi 4 で導入され、言語のコア機能の 1 つになり、VCL(Windowsアプリケーション開発)とFMX(クロスプラットフォームアプリケーション)の両方に適用されます。残念ながら、長い間 Delphi に存在していたにもかかわらず、TActionとTActionListは Delphi のコンポーネントのその他大勢のひとつであり、必要なほど頻繁に使用されていません。

TActionとは?なぜTActionを使うべきか

Generally, an action is a non-visual component that represents a user-generated command. It allows you to set up all the UI properties related to that command in one central place, along with the code required to execute the command and also code that can control if the command is available to the user or not. Actions are managed either through Action List or Action Manager which are both non-visual components in Delphi.

Ray Konopka also highlights the two base components of Actions that we might need to leverage. These are the TActionlist that literally manages a set of TAction components and provides design-time access to actions. Another base component is the TAction itself which generally implements a command on a target and is invoked by the client controls. It is also interesting to note that those things that we commonly interact with such as the buttons and menus have Action properties so you can connect your Client control with the Action.

Developers should use Action more often as they have many powerful benefits and can make your code easier to maintain. They allow application code to be modularized and defined independently of the controls that will invoke the code. Actions also centralize updates and things like visibility and enablement, thereby updating the action’s clients.

In this video, Konopka will demonstrate how exactly the Actions component works in Delphi. He will also provide a set of performance tips that you might consider applying to your project in the future. At the end of the video is a live Q & A with Ray and Embarcadero Delphi MVP Ian Barker where they answer live viewer’s questions.

To know more about Actions and to learn about their full potential, feel free to watch this video from the recently concluded DelphiCon 2023 below.   


RAD Studio、Delphi、C++Builderを用いれば、開発時間を短縮し、より早く市場に投入可能!
Design. Code. Compile. Deploy.
トライアル版をダウンロードいますぐアップグレード!

Delphi Community Edition(無料)C++Builder Community Edition(無料)