After reading a lot of theory of the interface and code separation, I don't know how everyone understands the COMMAND / ACTION mode. I also have such questions here. In general, in Dlephi, I mentioned the Command / Action mode. The first thing I think is a series of Action controls such as TAAActionList, TAACTIONManager, but it seems that the Delphi control design or event call method It is designed in a Command / Action mode. That is to say, you don't have to deliberately pursue the Command / Action mode but in general coding, it is enough to see some of me.
I understand my understanding of TButton's onclick event. Under normal circumstances, in our program is important to define this event directly to double-click the control and then write the code. The interface coupling is more serious because this function is actually mixed with the interface. If you want to modify the interface, it will be very troublesome. But I don't think so, I will implement the following example: If you want to use another Button2 (or a MenuItem or other Command event) to implement this feature, I can let Button2's OnClick event points to point button1click. And when you modify it, just maintain the code of Button1Click.
Or when I am in the initialization of Button2 (because Button2 can be created) to make Button2.onclick: = button1click, why do I have to implement this so-called TACTION?
Then, the control of the interface, with TACTION objects can make some simple operations on the interface object, but in general, I can also complete the same work by calling the Sender parameters of the function, such as I want all the calls. Button1click space disappears I can do this:
IF sender is tcontrol kiln tcontrol (sender) .visible: = false;
This is nothing difference between this and calling taction.visible.