procedure TCustomFrame.AddActionList(ActionList: TCustomActionList);
var
Form: TCustomForm;
begin
Form := GetParentForm(Self);
if Form <> nil then
begin
if Form.FActionLists = nil then Form.FActionLists := TList.Create;
Form.FActionLists.Add(ActionList);
end;
end;
我按住ctrl键,然后点GetParentForm(Self); 会跳到
function GetParentForm(Control: TControl): TCustomForm;
begin
while Control.Parent <> nil do Control := Control.Parent;
if Control is TCustomForm then
Result := TCustomForm(Control) else
Result := nil;
end;
如果这时我按ctrl+z会再回到
...
Form := GetParentForm(Self); 回到这.
...
这在看源代码的时候时候非常方便.
|