⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adproped.pas

📁 测试用例
💻 PAS
📖 第 1 页 / 共 2 页
字号:
  RegisterPropertyEditor(TypeInfo(string), TApdCustomFaxUnpacker,
                         'InFileName', TApdAPFFileNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TApdCustomFaxUnpacker,
                         'OutFileName', TApdGenericFileNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TApdCustomFaxViewer,
                         'FileName', TApdAPFFileNameProperty);
  RegisterPropertyEditor(TypeInfo(TPassString), TApdCustomAbstractFax,
                         'FaxFile', TApdAPFFileNameProperty);
  RegisterPropertyEditor(TypeInfo(TPassString), TApdCustomSendFax,
                         'CoverFile', TApdFaxCoverNameProperty);
  RegisterPropertyEditor(TypeInfo(TPassString), TApdFaxLog,
                         'FaxHistoryName', TApdHistoryNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TApdCustomFaxPrinter,
                         'FileName', TApdAPFFileNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TApdCustomFaxPrinterLog,
                         'LogFileName', TApdHistoryNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TApdFaxDriverInterface,
                         'FileName', TApdAPFFileNameProperty);
  RegisterPropertyEditor(TypeInfo(TPassString), TApdFaxClient,
                         'CoverFileName', TApdGenericFileNameProperty);
  RegisterPropertyEditor(TypeInfo(TPassString), TApdFaxClient,
                         'FaxFileName', TApdAPFFileNameProperty);
  RegisterPropertyEditor(TypeInfo(TPassString), TApdFaxClient,
                         'JobFileName', TApdAPJNameProperty);

  { property editors for directory properties }
  RegisterPropertyEditor(TypeInfo(string), TAdCustomModem,
                         'ModemCapFolder', TApdDirectoryProperty);
  RegisterPropertyEditor(TypeInfo(string), TApdCustomProtocol,
                         'DestinationDirectory', TApdDirectoryProperty);
  RegisterPropertyEditor(TypeInfo(TPassString), TApdCustomReceiveFax,
                         'DestinationDir', TApdDirectoryProperty);
  RegisterPropertyEditor(TypeInfo(TPassString), TApdCustomFaxServer,
                         'DestinationDir', TApdDirectoryProperty);
  RegisterPropertyEditor(TypeInfo(TPassString), TApdFaxServerManager,
                         'MonitorDir', TApdDirectoryProperty);

  { component editors }
  RegisterComponentEditor(TApdDataPacket, TApdPacketEditor);
  RegisterComponentEditor(TApdCustomState, TApdStateEditor);
  RegisterComponentEditor(TApdCustomVoip, TapdVoipAudioVideoEditor); 
end;

function TApdValidEnumProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paMultiSelect, paValueList];
end;

procedure TApdValidEnumProperty.GetValues(Proc: TGetStrProc);
var
  I : Integer;
  EnumType : PTypeInfo;
  SaveValue : string;
begin
  EnumType := GetPropType;
  SaveValue := Value;
  with GetTypeData(EnumType)^ do begin
    for I := MinValue to MaxValue do begin
      Value := GetEnumName(EnumType, I);
      if GetEnumValue(EnumType, Value) = I then Proc(Value);
    end;
  end;
  Value := SaveValue;
end;

function TApdPacketStringProperty.GetValue: string;
begin
  Result := StrToCtrlStr(inherited GetValue);
end;

procedure TApdPacketStringProperty.SetValue(const Value: string);
begin
  inherited SetValue(CtrlStrToStr(Value));
end;

{*** TApdPacketEditor ***}

procedure TApdPacketEditor.ExecuteVerb(Index: Integer);
begin
  if EditPacket(Component as TApdDataPacket,Component.Name) then
    Designer.Modified;
end;

function TApdPacketEditor.GetVerb(Index: Integer): string;
begin
  Result := 'Edit properties...';
end;

function TApdPacketEditor.GetVerbCount: Integer;
begin
  Result := 1;
end;

{*** TApdVersionProperty ***}

function TApdVersionProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog, paReadOnly];
end;

procedure TApdVersionProperty.Edit;
begin
  with TApdAboutForm.Create(Application) do begin
    try
      ShowModal;
    finally
      Free;
    end;
  end;
end;

{*** TApdStateEditor ***}

procedure TApdStateEditor.ExecuteVerb(Index: Integer);
begin
  if EditState(Component as TApdCustomState,Component.Name) then
    Designer.Modified;
end;

function TApdStateEditor.GetVerb(Index: Integer): string;
begin
  Result := 'Edit conditions...';
end;

function TApdStateEditor.GetVerbCount: Integer;
begin
  Result := 1;
end;

{*** TApdGenericFileNameProperty ***}

function TApdGenericFileNameProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog];
end;

procedure TApdGenericFileNameProperty.Edit;
const
  ApdRegAPFFilter = 'Fax files (*.APF)|*.APF';
  ApdRegConverterFilter = 'Bitmap files (*.BMP)|*.BMP|TIFF Files (*.TIF)|*.TIF|'
                    + 'PCX files (*.PCX)|*.PCX|Text files (*.TXT)|*.TXT)';
  ApdRegLogFilter = 'Log files (*.LOG)|*.LOG';
  ApdRegTraceFilter = 'Trace files (*.TRC)|*.TRC';
  ApdRegHistoryFilter = 'History files (*.HIS)|*.HIS';
  ApdRegCaptureFilter = 'Capture files (*.CAP)|*.CAP';
  ApdRegAPJFilter = 'Fax job files (*.APJ)|*.APJ';
  ApdRegFaxCoverFilter = ApdRegAPFFilter + '|Text files (*.TXT)|*.TXT';
  ApdRegDefFilter = 'All files (*.*)|*.*';
var
  Dlg : TOpenDialog;
  Filter : string;
begin
  Filter := '';
  if Self is TApdAPFFileNameProperty then
    Filter := ApdRegAPFFilter
  else if Self is TApdConverterNameProperty then
    Filter := ApdRegConverterFilter
  else if Self is TApdLogNameProperty then
    Filter := ApdRegLogFilter
  else if Self is TApdTraceNameProperty then
    Filter := ApdRegTraceFilter
  else if Self is TApdHistoryNameProperty then
    Filter := ApdRegHistoryFilter
  else if Self is TApdCaptureNameProperty then
    Filter := ApdRegCaptureFilter
  else if Self is TApdAPJNameProperty then
    Filter := ApdRegAPJFilter
  else if Self is TApdFaxCoverNameProperty then
    Filter := ApdRegFaxCoverFilter;

  if Filter = '' then
    Filter := ApdRegDefFilter
  else
    Filter := Filter + '|' + ApdRegDefFilter;

  Dlg := TOpenDialog.Create(Application);
  try
    Dlg.DefaultExt := '*.*';
    Dlg.Filter := Filter;
    Dlg.FilterIndex := 0;
    Dlg.Options := [ofHideReadOnly];
    Dlg.FileName := Value;
    if Dlg.Execute then
      Value := Dlg.FileName;
  finally
    Dlg.Free;
  end;
end;

{ TApdDirectoryProperty }
function TApdDirectoryProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog];
end;

procedure TApdDirectoryProperty.Edit;
var
  Dir : string;
begin
  Dir := Value;
  if SelectDirectory(Dir, [sdAllowCreate], 0) then
    Value := Dir;
end;

procedure TApdVoipAudioVideoEditor.ExecuteVerb(Index: Integer);
begin
  if EditVoipAudioVideo (Component as TApdVoip, Component.Name) then
    Designer.Modified;
end;

function TApdVoipAudioVideoEditor.GetVerb(Index: Integer): string;
begin
  Result := 'Edit properties...';
end;

function TApdVoipAudioVideoEditor.GetVerbCount: Integer;
begin
  Result := 1;
end;

function TApdVoipAudioVideoProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog];
end;

procedure TApdVoipAudioVideoProperty.Edit;
var
  VoipComponent : TApdVoip;
  CompName : string;
begin
  VoipComponent := GetComponent (0) as TApdVoip;
  CompName := VoipComponent.Name;
  if PropCount > 1 then
    CompName := CompName + '...';
  if EditVoipAudioVideo (VoipComponent, CompName) then begin
//    Modified;
  end;
end;

end.

⌨️ 快捷键说明

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