📄 jvdyncontrolenginevcl.pas
字号:
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetAutoSize(Value: Boolean);
procedure ControlSetIncrementalDisplay(Value: Boolean);
procedure ControlSetCenter(Value: Boolean);
{$IFDEF VCL}
procedure ControlSetProportional(Value: Boolean);
{$ENDIF VCL}
procedure ControlSetStretch(Value: Boolean);
procedure ControlSetTransparent(Value: Boolean);
procedure ControlSetPicture(Value: TPicture);
procedure ControlSetGraphic(Value: TGraphic);
function ControlGetPicture: TPicture;
end;
TJvDynControlVCLScrollBox = class(TScrollbox, IUnknown,
IJvDynControl)
public
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
end;
TJvDynControlVCLLabel = class(TLabel, IUnknown,
IJvDynControl, IJvDynControlLabel)
public
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetFocusControl(Value: TWinControl);
procedure ControlSetWordWrap(Value: Boolean);
end;
{$IFDEF VCL}
TJvDynControlVCLStaticText = class(TStaticText, IUnknown,
IJvDynControl)
public
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
end;
{$ENDIF VCL}
TJvDynControlVCLButton = class(TBitBtn, IUnknown,
IJvDynControl, IJvDynControlButton, IJvDynControlAction)
public
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetGlyph(Value: TBitmap);
procedure ControlSetNumGlyphs(Value: Integer);
procedure ControlSetLayout(Value: TButtonLayout);
procedure ControlSetDefault(Value: Boolean);
procedure ControlSetCancel(Value: Boolean);
// IJvDynControlAction
procedure ControlSetAction(Value: TCustomAction);
end;
TJvDynControlVCLRadioButton = class(TRadioButton, IUnknown,
IJvDynControl, IJvDynControlData)
public
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
// IJvDynControlData
procedure ControlSetOnChange(Value: TNotifyEvent);
procedure ControlSetValue(Value: Variant);
function ControlGetValue: Variant;
end;
TJvDynControlVCLTreeView = class(TTreeView, IUnknown,
IJvDynControl, IJvDynControlTreeView, IJvDynControlReadOnly)
public
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
// IJvDynControlReadOnly
procedure ControlSetReadOnly(Value: Boolean);
// IJvDynControlTreeView
procedure ControlSetAutoExpand(Value: Boolean);
procedure ControlSetHotTrack(Value: Boolean);
procedure ControlSetShowHint(Value: Boolean);
procedure ControlSetShowLines(Value: Boolean);
procedure ControlSetShowRoot(Value: Boolean);
procedure ControlSetToolTips(Value: Boolean);
procedure ControlSetItems(Value: TTreeNodes);
function ControlGetItems: TTreeNodes;
procedure ControlSetImages(Value: TCustomImageList);
procedure ControlSetStateImages(Value: TCustomImageList);
function ControlGetSelected: TTreeNode;
procedure ControlSetOnChange(Value: TTVChangedEvent);
procedure ControlSetSortType(Value: TSortType);
end;
function DynControlEngineVCL: TJvDynControlEngine;
{$IFDEF UNITVERSIONING}
const
UnitVersioning: TUnitVersionInfo = (
RCSfile: '$RCSfile: JvDynControlEngineVCL.pas,v $';
Revision: '$Revision: 1.51 $';
Date: '$Date: 2005/03/09 07:24:57 $';
LogPath: 'JVCL\run'
);
{$ENDIF UNITVERSIONING}
implementation
uses
{$IFDEF HAS_UNIT_VARIANTS}
Variants,
{$ENDIF HAS_UNIT_VARIANTS}
SysUtils,
JvDynControlEngineTools, JvConsts, JvJCLUtils;
var
IntDynControlEngineVCL: TJvDynControlEngine = nil;
//=== { TJvDynControlVCLMaskEdit } ===========================================
procedure TJvDynControlVCLMaskEdit.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlVCLMaskEdit.ControlSetReadOnly(Value: Boolean);
begin
ReadOnly := Value;
end;
procedure TJvDynControlVCLMaskEdit.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlVCLMaskEdit.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlVCLMaskEdit.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlVCLMaskEdit.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlVCLMaskEdit.ControlSetOnChange(Value: TNotifyEvent);
begin
OnChange := Value;
end;
procedure TJvDynControlVCLMaskEdit.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlVCLMaskEdit.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlVCLMaskEdit.ControlSetValue(Value: Variant);
begin
Text := Value;
end;
function TJvDynControlVCLMaskEdit.ControlGetValue: Variant;
begin
Result := Text;
end;
procedure TJvDynControlVCLMaskEdit.ControlSetPasswordChar(Value: Char);
begin
{$IFDEF VCL}
PasswordChar := Value;
{$ENDIF VCL}
{$IFDEF VisualCLX}
if Value = #0 then
EchoMode := emNormal
else
EchoMode := emPassword;
{$ENDIF VisualCLX}
end;
procedure TJvDynControlVCLMaskEdit.ControlSetEditMask(const Value: string);
begin
EditMask := Value;
end;
//=== { TJvDynControlVCLButtonEdit } =========================================
constructor TJvDynControlVCLButtonEdit.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.Caption := '...';
Height := FEditControl.Height;
FButton.Width := Height;
FEditControl.Align := alClient;
BevelInner := bvNone;
BevelOuter := bvNone;
end;
destructor TJvDynControlVCLButtonEdit.Destroy;
begin
FreeAndNil(FEditControl);
FreeAndNil(FButton);
inherited Destroy;
end;
procedure TJvDynControlVCLButtonEdit.ControlSetDefaultProperties;
begin
Self.Caption := ' ';
end;
procedure TJvDynControlVCLButtonEdit.ControlSetReadOnly(Value: Boolean);
begin
FEditControl.ReadOnly := Value;
end;
procedure TJvDynControlVCLButtonEdit.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlVCLButtonEdit.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlVCLButtonEdit.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlVCLButtonEdit.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlVCLButtonEdit.ControlSetOnChange(Value: TNotifyEvent);
begin
FEditControl.OnChange := Value;
end;
procedure TJvDynControlVCLButtonEdit.ControlSetOnClick(Value: TNotifyEvent);
begin
FEditControl.OnClick := Value;
end;
procedure TJvDynControlVCLButtonEdit.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlVCLButtonEdit.ControlSetValue(Value: Variant);
begin
FEditControl.Text := Value;
end;
function TJvDynControlVCLButtonEdit.ControlGetValue: Variant;
begin
Result := FEditControl.Text;
end;
{$IFDEF VisualCLX}
type
TMaskEditAccessProtected = class(TMaskEdit);
{$ENDIF VisualCLX}
procedure TJvDynControlVCLButtonEdit.ControlSetPasswordChar(Value: Char);
begin
{$IFDEF VCL}
FEditControl.PasswordChar := Value;
{$ENDIF VCL}
{$IFDEF VisualCLX}
if Value = #0 then
TMaskEditAccessProtected(FEditControl).EchoMode := emNormal
else
TMaskEditAccessProtected(FEditControl).EchoMode := emPassword;
{$ENDIF VisualCLX}
end;
procedure TJvDynControlVCLButtonEdit.ControlSetEditMask(const Value: string);
begin
FEditControl.EditMask := Value;
end;
procedure TJvDynControlVCLButtonEdit.ControlSetOnButtonClick(Value: TNotifyEvent);
begin
FButton.OnClick := Value;
end;
procedure TJvDynControlVCLButtonEdit.ControlSetButtonCaption(const Value: string);
begin
FButton.Caption := Value;
end;
procedure TJvDynControlVCLButtonEdit.ControlSetGlyph(Value: TBitmap);
begin
FButton.Glyph.Assign(Value);
end;
procedure TJvDynControlVCLButtonEdit.ControlSetNumGlyphs(Value: Integer);
begin
FButton.NumGlyphs := Value;
end;
procedure TJvDynControlVCLButtonEdit.ControlSetLayout(Value: TButtonLayout);
begin
FButton.Layout := Value;
end;
procedure TJvDynControlVCLButtonEdit.ControlSetDefault(Value: Boolean);
begin
FButton.Default := Value;
end;
procedure TJvDynControlVCLButtonEdit.ControlSetCancel(Value: Boolean);
begin
FButton.Cancel := Value;
end;
//=== { TJvDynControlVCLFileNameEdit } =======================================
constructor TJvDynControlVCLFileNameEdit.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;
FDialogOptions := [ofHideReadOnly,ofEnableSizing];
BevelInner := bvNone;
BevelOuter := bvNone;
FDialogKind := jdkOpen;
end;
destructor TJvDynControlVCLFileNameEdit.Destroy;
begin
FreeAndNil(FEditControl);
FreeAndNil(FButton);
inherited Destroy;
end;
procedure TJvDynControlVCLFileNameEdit.DefaultOnButtonClick(Sender: TObject);
begin
case FDialogKind of
jdkOpen:
with TOpenDialog.Create(Self) do
try
Options := FDialogOptions;
Title := FDialogTitle;
Filter := FFilter;
FilterIndex := FFilterIndex;
InitialDir := FInitialDir;
DefaultExt := FDefaultExt;
FileName := ControlGetValue;
if Execute then
ControlSetValue(FileName);
finally
Free;
end;
jdkOpenPicture:
with TOpenPictureDialog.Create(Self) do
try
Options := FDialogOptions;
Title := FDialogTitle;
Filter := FFilter;
FilterIndex := FFilterIndex;
InitialDir := FInitialDir;
DefaultExt := FDefaultExt;
FileName := ControlGetValue;
if Execute then
ControlSetValue(FileName);
finally
Free;
end;
jdkSave:
with TSaveDialog.Create(Self) do
try
Options := FDialogOptions;
Title := FDialogTitle;
Filter := FFilter;
FilterIndex := FFilterIndex;
InitialDir := FInitialDir;
DefaultExt := FDefaultExt;
FileName := ControlGetValue;
if Execute then
ControlSetValue(FileName);
finally
Free;
end;
jdkSavePicture:
with TSavePictureDialog.Create(Self) do
try
Options := FDialogOptions;
Title := FDialogTitle;
Filter := FFilter;
FilterIndex := FFilterIndex;
InitialDir := FInitialDir;
DefaultExt := FDefaultExt;
FileName := ControlGetValue;
if Execute then
ControlSetValue(FileName);
finally
Free;
end;
end;
if FEditControl.CanFocus then
FEditControl.SetFocus;
end;
procedure TJvDynControlVCLFileNameEdit.ControlSetDefaultProperties;
begin
Caption := ' ';
end;
procedure TJvDynControlVCLFileNameEdit.ControlSetReadOnly(Value: Boolean);
begin
FEditControl.ReadOnly := Value;
FButton.Enabled := not Value;
end;
procedure TJvDynControlVCLFileNameEdit.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlVCLFileNameEdit.ControlSetTabOrder(Value: Integer);
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -