pbfolderdialogreg.pas

来自「wil编辑器所需控件,传奇wil文件查看编辑器所用到的另一个重要控件,也是在外国」· PAS 代码 · 共 75 行

PAS
75
字号
unit PBFolderDialogReg;

{$INCLUDE PBDefines.inc}

interface

uses
	SysUtils, Classes,
{$IFDEF COMPILER_MAX_5} DsgnIntf;
{$ELSE}	DesignIntf, DesignEditors, VCLEditors;
{$ENDIF}

procedure Register;

implementation

uses PBFolderDialog, PBShellFolders;

type
// ---------------  PropertyEditor TFolderListProperty  ---------
	TShellFolderPathProperty = class(TStringProperty)
	protected
		FValueList : TStringList;
	public
		destructor Destroy; override;
		procedure Initialize; override;
		function GetAttributes : TPropertyAttributes; override;
		procedure GetValues(Proc: TGetStrProc); override;
	end;

destructor TShellFolderPathProperty.Destroy;
begin
	FValueList.Free;
	FValueList := nil;
	inherited Destroy;
end;

function TShellFolderPathProperty.GetAttributes : TPropertyAttributes;
begin
	Result := [paValueList, paSortList, paRevertable];
end;

procedure TShellFolderPathProperty.Initialize;
var
	t : integer;
begin
	inherited Initialize;
	FValueList := TStringList.Create;
	for t := 0 to MAX_SHELLFOLDERNAMES
		do if ShellFolderNames[t] <> '%%'
		then FValuelist.Add(ShellFolderNames[t]);
end;

procedure TShellFolderPathProperty.GetValues(Proc: TGetStrProc);
var
	t : integer;
begin
	t := 0;
	while t < FValueList.Count do
	begin
		Proc(FValueList[t]);
		Inc(t);
	end;
end;

//  ---------------------  Register  ----------------------------
procedure Register;
begin
	RegisterComponents('PB', [TPBFolderDialog]);
	RegisterPropertyEditor(TypeInfo(TShellFolderPath), TPBFolderDialog, '',
		TShellFolderPathProperty);
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?