procedure TFm_Main.Action_BeginUpdate(Sender: TObject); begin (Sender as TAction).Enabled:=(not gFlag); end;
procedure TFm_Main.Action_EndUpdate(Sender: TObject); begin (Sender as TAction).Enabled:=gFlag; end;
我不懂这里的Sender怎么用,在这里是一种什么用法,Sender as TAction是什么意思呢?其中gFlag是一个boolean变量,Action_Begin,Action_end是Actionlist中的两个Actions;小弟在这里不耻下问,希望各位大侠能够多多指教.
----------------------------------------------
DELPHI朋友,大家好
In an event handler, the Sender parameter indicates which component received the event and therefore called the handler. Sometimes it is useful to have several components share an event handler that behaves differently depending on which component calls it. You can do this by using the Sender parameter in an if...then...else statement. For example, the following code displays the title of the application in the caption of a dialog box only if the OnClick event was received by Button1.