Action 相关组件


TAction //<- TCustomAction <- TContainedAction <- TBasicAction <- TComponent

TActionList //<- TCustomActionList <- TComponent
//其父类 TCustomActionList 包含一个 TContainedAction 类型的动作列表(Actions[])

TActionManager //<- TCustomActionManager <- TCustomActionList <- TComponent)
//其父父类 TCustomActionList 包含一个 TContainedAction 类型的动作列表(Actions[])

TCustomizeDlg //<- TComponent
//它拥有 ActionManager: TCustomActionManager 属性

TActionToolBar //<- TCustomActionToolBar <- TCustomActionDockBar <- TCustomActionBar <- TToolWindow <<<- TComponent
//其父父父类 TCustomActionBar 拥有 ActionManager: TCustomActionManager 属性.

TActionMainMenuBar //<- TCustomActionMainMenuBar <- TCustomActionMenuBar <- TCustomActionDockBar <- TCustomActionBar <- TToolWindow <<<- TComponent
//其父父父父类 TCustomActionBar 拥有 ActionManager: TCustomActionManager 属性.

TMenuItem //<- TComponent
//它拥有 Action: TBasicAction 属性

TPopupActionBar //<- TPopupMenu <- TMenu <- TComponent
//它内部拥有 FActionManager: TCustomActionManager 成员


{ StdActns 单元一些更具体的类: }

THintAction   //<- TCustomAction <- TContainedAction <- TBasicAction <- TComponent

TEditAction   //<- TAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
TEditAction -> TEditCut、TEditCopy、TEditPaste、TEditSelectAll、TEditUndo、TEditDelete、TEditSelectAll、TEditSelectAll

TWindowAction //<- TAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
TWindowAction -> TWindowClose、TWindowCascade、TWindowTileHorizontal、TWindowTileVertical、TWindowMinimizeAll、TWindowArrange

THelpAction   //<- TAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
THelpAction -> THelpContents、THelpTopicSearch、THelpOnHelp、THelpContextAction

TFileAction   //<- TCommonDialogAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
TFileAction -> TFileOpenWith、TFileSaveAs、TFilePrintSetup、TFilePageSetup、TFileExit

TSearchFind      //<- TSearchAction <- TCommonDialogAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
TSearchReplace   //<- TSearchAction <- TCommonDialogAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
TSearchFindFirst //<- TSearchFind <- TSearchAction <- TCommonDialogAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
TSearchFindNext  //<- TCustomAction <- TContainedAction <- TBasicAction <- TComponent

TFontEdit        //<- TCommonDialogAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
TColorSelect     //<- TCommonDialogAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
TPrintDlg        //<- TCommonDialogAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
TBrowseForFolder //<- TCommonDialogAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent


{ 另有 ExtActns 单元下的: }
TFileRun、TRichEditAction、TRichEditBold、TRichEditItalic、TRichEditUnderline、TRichEditStrikeOut、TRichEditStrikeOut、
TRichEditBullets、TRichEditAlignLeft、TRichEditAlignRight、TRichEditAlignCenter、TTabAction、TPreviousTab、TNextTab、
TOpenPicture、TSavePicture、TURLAction、TBrowseURL、TDownLoadURL、TSendMail

{ DBActns 单元下的: }
TDataSetAction、TDataSetFirst、TDataSetPrior、TDataSetNext、TDataSetLast、TDataSetInsert、
TDataSetDelete、TDataSetEdit、TDataSetPost、TDataSetCancel、TDataSetRefresh

{ ActnRes 单元下的: }
TStandardActions

//它们一般用在窗体设计时


使用 TBrowseURL 打开网页:

uses ExtActns;

procedure TForm1.Button1Click(Sender: TObject);
begin
  with TBrowseURL.Create(nil) do
  begin
    URL := 'http://del.cnblogs.com';
    Execute;
    Free;
  end;
end;


关联 TBrowseURL 到 TSpeedButton:

uses ExtActns, Buttons;

var
  bUrl: TBrowseURL;
  sBtn: TSpeedButton;

procedure TForm1.FormCreate(Sender: TObject);
begin
  bUrl := TBrowseURL.Create(Self);
  bUrl.URL := 'http://del.cnblogs.com';
  bUrl.Caption := 'Open URL';

  sBtn := TSpeedButton.Create(Self);
  sBtn.Parent := Self;
  sBtn.Width := 100;
  sBtn.Action := bUrl;
end;


使用 TDownLoadURL 下载文件:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtActns, ComCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    ProgressBar1: TProgressBar;
    procedure Button1Click(Sender: TObject);
  private
    procedure DownProgress(Sender: TDownLoadURL; Progress, ProgressMax: Cardinal;
      StatusCode: TURLDownloadStatus; StatusText: String; var Cancel: Boolean);
  public
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  Button1.Enabled := False;
  with TDownLoadURL.Create(nil) do
  begin
    URL := 'http://files.cnblogs.com/del/PMark_1.rar';
    Filename := 'c:\temp\PMark_1.rar';
    OnDownloadProgress := DownProgress; //下载进度
    ExecuteTarget(nil);
    Free;
  end;
  Button1.Enabled := True;
end;

procedure TForm1.DownProgress(Sender: TDownLoadURL; Progress, ProgressMax: Cardinal;
  StatusCode: TURLDownloadStatus; StatusText: String; var Cancel: Boolean);
begin
  ProgressBar1.Max := ProgressMax;
  ProgressBar1.Position := Progress;
  Application.ProcessMessages;
end;

end.

你可能感兴趣的:(action)