📄 jvdyncontrolenginevcl.pas
字号:
TabOrder := Value;
end;
procedure TJvDynControlVCLFileNameEdit.ControlSetOnEnter(Value: TNotifyEvent);
begin
FEditControl.OnEnter := Value;
end;
procedure TJvDynControlVCLFileNameEdit.ControlSetOnExit(Value: TNotifyEvent);
begin
FEditControl.OnExit := Value;
end;
procedure TJvDynControlVCLFileNameEdit.ControlSetOnChange(Value: TNotifyEvent);
begin
FEditControl.OnChange := Value;
end;
procedure TJvDynControlVCLFileNameEdit.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlVCLFileNameEdit.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlVCLFileNameEdit.ControlSetValue(Value: Variant);
begin
FEditControl.Text := Value;
end;
function TJvDynControlVCLFileNameEdit.ControlGetValue: Variant;
begin
Result := FEditControl.Text;
end;
// IJvDynControlFileName
procedure TJvDynControlVCLFileNameEdit.ControlSetInitialDir(const Value: string);
begin
FInitialDir := Value;
end;
procedure TJvDynControlVCLFileNameEdit.ControlSetDefaultExt(const Value: string);
begin
FDefaultExt := Value;
end;
procedure TJvDynControlVCLFileNameEdit.ControlSetDialogTitle(const Value: string);
begin
FDialogTitle := Value;
end;
procedure TJvDynControlVCLFileNameEdit.ControlSetDialogOptions(Value: TOpenOptions);
begin
FDialogOptions := Value;
end;
procedure TJvDynControlVCLFileNameEdit.ControlSetFilter(const Value: string);
begin
FFilter := Value;
end;
procedure TJvDynControlVCLFileNameEdit.ControlSetFilterIndex(Value: Integer);
begin
FFilterIndex := Value;
end;
procedure TJvDynControlVCLFileNameEdit.ControlSetDialogKind(Value: TJvDynControlFileNameDialogKind);
begin
FDialogKind := Value;
end;
//=== { TJvDynControlVCLDirectoryEdit } ======================================
constructor TJvDynControlVCLDirectoryEdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FEditControl := TMaskEdit.Create(AOwner);
FEditControl.Parent := Self;
FButton := TBitBtn.Create(AOwner);
FButton.Parent := Self;
FButton.Align := alRight;
FButton.OnClick := DefaultOnButtonClick;
FButton.Caption := '...';
Height := FEditControl.Height;
FButton.Width := Height;
FEditControl.Align := alClient;
BevelInner := bvNone;
BevelOuter := bvNone;
end;
destructor TJvDynControlVCLDirectoryEdit.Destroy;
begin
FreeAndNil(FEditControl);
FreeAndNil(FButton);
inherited Destroy;
end;
procedure TJvDynControlVCLDirectoryEdit.DefaultOnButtonClick(Sender: TObject);
var
{$IFDEF VCL}
Opt: TSelectDirOpts;
Dir: string;
{$ENDIF VCL}
{$IFDEF VisualCLX}
Dir: WideString;
{$ENDIF VisualCLX}
begin
Dir := ControlGetValue;
if Dir = '' then
if FInitialDir <> '' then
Dir := FInitialDir
else
Dir := PathDelim;
if not DirectoryExists(Dir) then
Dir := PathDelim;
{$IFDEF VCL}
if SelectDirectory(Dir, Opt, HelpContext) then
{$ENDIF VCL}
{$IFDEF VisualCLX}
{$IFDEF MSWINDOWS}
if SelectDirectory('', '', Dir) then
{$ENDIF MSWINDOWS}
{$IFDEF UNIX}
if SelectDirectory('', '/', Dir, False) then
{$ENDIF UNIX}
{$ENDIF VisualCLX}
ControlSetValue(Dir);
if FEditControl.CanFocus then
FEditControl.SetFocus;
end;
procedure TJvDynControlVCLDirectoryEdit.ControlSetDefaultProperties;
begin
Self.Caption := ' ';
end;
procedure TJvDynControlVCLDirectoryEdit.ControlSetReadOnly(Value: Boolean);
begin
FEditControl.ReadOnly := Value;
FButton.Enabled := not Value;
end;
procedure TJvDynControlVCLDirectoryEdit.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlVCLDirectoryEdit.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlVCLDirectoryEdit.ControlSetOnEnter(Value: TNotifyEvent);
begin
FEditControl.OnEnter := Value;
end;
procedure TJvDynControlVCLDirectoryEdit.ControlSetOnExit(Value: TNotifyEvent);
begin
FEditControl.OnExit := Value;
end;
procedure TJvDynControlVCLDirectoryEdit.ControlSetOnChange(Value: TNotifyEvent);
begin
FEditControl.OnChange := Value;
end;
procedure TJvDynControlVCLDirectoryEdit.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlVCLDirectoryEdit.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlVCLDirectoryEdit.ControlSetValue(Value: Variant);
begin
FEditControl.Text := Value;
end;
function TJvDynControlVCLDirectoryEdit.ControlGetValue: Variant;
begin
Result := FEditControl.Text;
end;
procedure TJvDynControlVCLDirectoryEdit.ControlSetInitialDir(const Value: string);
begin
FInitialDir := Value;
end;
procedure TJvDynControlVCLDirectoryEdit.ControlSetDialogTitle(const Value: string);
begin
FDialogTitle := Value;
end;
{$IFDEF VCL}
procedure TJvDynControlVCLDirectoryEdit.ControlSetDialogOptions(Value: TSelectDirOpts);
begin
FDialogOptions := Value;
end;
{$ENDIF VCL}
{$IFDEF VCL}
//=== { TJvDynControlVCLDateTimeEdit } =======================================
constructor TJvDynControlVCLDateTimeEdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Caption := '';
BorderStyle := bsNone;
BevelInner := bvNone;
BevelOuter := bvNone;
FDatePicker := TDateTimePicker.Create(Self);
FDatePicker.Parent := Self;
FDatePicker.Align := alLeft;
FDatePicker.Top := 0;
FDatePicker.Left := 0;
FTimePicker := TDateTimePicker.Create(Self);
FTimePicker.Align := alClient;
FTimePicker.Parent := Self;
FTimePicker.Top := 0;
FTimePicker.Left := 0;
Height := FDatePicker.Height;
Width := FDatePicker.Width + FTimePicker.Width;
OnResize := ControlResize;
ControlResize(nil);
FDatePicker.DateFormat := dfShort;
FDatePicker.DateMode := dmComboBox;
FDatePicker.Kind := dtkDate;
FTimePicker.DateFormat := dfShort;
FTimePicker.DateMode := dmUpDown;
FTimePicker.Kind := dtkTime;
end;
destructor TJvDynControlVCLDateTimeEdit.Destroy;
begin
FreeAndNil(FDatePicker);
FreeAndNil(FTimePicker);
inherited Destroy;
end;
procedure TJvDynControlVCLDateTimeEdit.ControlResize(Sender: TObject);
begin
FDatePicker.Height := Round(Height / 2);
FTimePicker.Height := Height;
FDatePicker.Width := Round(Width / 2);
end;
procedure TJvDynControlVCLDateTimeEdit.ControlSetDefaultProperties;
begin
Self.Caption := ' ';
end;
procedure TJvDynControlVCLDateTimeEdit.ControlSetCaption(const Value: string);
begin
//Caption := Value;
end;
procedure TJvDynControlVCLDateTimeEdit.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlVCLDateTimeEdit.ControlSetOnEnter(Value: TNotifyEvent);
begin
FDatePicker.OnEnter := Value;
FTimePicker.OnEnter := Value;
end;
procedure TJvDynControlVCLDateTimeEdit.ControlSetOnExit(Value: TNotifyEvent);
begin
FDatePicker.OnExit := Value;
FTimePicker.OnExit := Value;
end;
procedure TJvDynControlVCLDateTimeEdit.ControlSetOnChange(Value: TNotifyEvent);
begin
FDatePicker.OnChange := Value;
FTimePicker.OnChange := Value;
end;
procedure TJvDynControlVCLDateTimeEdit.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlVCLDateTimeEdit.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlVCLDateTimeEdit.ControlSetValue(Value: Variant);
begin
FDatePicker.Date := Value;
FTimePicker.Time := Value;
end;
function TJvDynControlVCLDateTimeEdit.ControlGetValue: Variant;
begin
Result := Trunc(FDatePicker.Date) + (Trunc(FTimePicker.Time) - FTimePicker.Time);
end;
// IJvDynControlDate
procedure TJvDynControlVCLDateTimeEdit.ControlSetMinDate(Value: TDateTime);
begin
FDatePicker.MinDate := Value;
end;
procedure TJvDynControlVCLDateTimeEdit.ControlSetMaxDate(Value: TDateTime);
begin
FDatePicker.MaxDate := Value;
end;
procedure TJvDynControlVCLDateTimeEdit.ControlSetFormat(const Value: string);
begin
{$IFDEF COMPILER6_UP}
FDatePicker.Format := Value;
FTimePicker.Format := Value;
{$ENDIF COMPILER6_UP}
end;
//=== { TJvDynControlVCLDateEdit } ===========================================
procedure TJvDynControlVCLDateEdit.ControlSetDefaultProperties;
begin
DateFormat := dfShort;
DateMode := dmComboBox;
Kind := dtkDate;
end;
procedure TJvDynControlVCLDateEdit.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlVCLDateEdit.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlVCLDateEdit.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlVCLDateEdit.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlVCLDateEdit.ControlSetOnChange(Value: TNotifyEvent);
begin
OnChange := Value;
end;
procedure TJvDynControlVCLDateEdit.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlVCLDateEdit.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlVCLDateEdit.ControlSetValue(Value: Variant);
begin
Date := Value;
end;
function TJvDynControlVCLDateEdit.ControlGetValue: Variant;
begin
Result := Date;
end;
// IJvDynControlDate
procedure TJvDynControlVCLDateEdit.ControlSetMinDate(Value: TDateTime);
begin
MinDate := Value;
end;
procedure TJvDynControlVCLDateEdit.ControlSetMaxDate(Value: TDateTime);
begin
MaxDate := Value;
end;
procedure TJvDynControlVCLDateEdit.ControlSetFormat(const Value: string);
begin
{$IFDEF COMPILER6_UP}
Format := Value;
{$ENDIF COMPILER6_UP}
end;
//=== { TJvDynControlVCLTimeEdit } ===========================================
procedure TJvDynControlVCLTimeEdit.ControlSetDefaultProperties;
begin
DateFormat := dfShort;
Kind := dtkTime;
DateMode := dmUpDown;
end;
procedure TJvDynControlVCLTimeEdit.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlVCLTimeEdit.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlVCLTimeEdit.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlVCLTimeEdit.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlVCLTimeEdit.ControlSetOnChange(Value: TNotifyEvent);
begin
OnChange := Value;
end;
procedure TJvDynControlVCLTimeEdit.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlVCLTimeEdit.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlVCLTimeEdit.ControlSetValue(Value: Variant);
begin
Time := Value;
end;
function TJvDynControlVCLTimeEdit.ControlGetValue: Variant;
begin
Result := Time;
end;
procedure TJvDynControlVCLTimeEdit.ControlSetFormat(const Value: string);
begin
{$IFDEF COMPILER6_UP}
Format := Value;
{$ENDIF COMPILER6_UP}
end;
{$ENDIF VCL}
//=== { TJvDynControlVCLCheckBox } ===========================================
procedure TJvDynControlVCLCheckBox.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlVCLCheckBox.ControlSetCaption(const Value: string);
begin
Caption := Value;
end;
procedure TJvDynControlVCLCheckBox.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlVCLCheckBox.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlVCLCheckBox.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlVCLCheckBox.ControlSetOnChange(Value: TNotifyEvent);
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -