?? rxctlreg.pas
字號:
{*******************************************************}
{ }
{ Delphi VCL Extensions (RX) }
{ }
{ Copyright (c) 1995, 1996 AO ROSNO }
{ Copyright (c) 1997, 1998 Master-Bank }
{ }
{*******************************************************}
{ Note:
- in Delphi 4.0 you must add DCLSTD40 and DCLSMP40 to the requires
page of the package you install this components into.
- in Delphi 3.0 you must add DCLSTD30 and DCLSMP30 to the requires
page of the package you install this components into.
- in C++Builder 3.0 you must add DCLSTD35 to the requires page of the
package you install this components into. }
unit RxCtlReg;
{$I RX.INC}
{$D-,L-,S-}
interface
{ Register custom useful controls }
procedure Register;
implementation
{$IFDEF WIN32}
{$R *.D32}
{$ELSE}
{$R *.D16}
{$ENDIF}
uses {$IFDEF WIN32} Windows, {$ELSE} WinTypes, {$ENDIF} Classes, SysUtils,
RTLConsts, DesignIntf, DesignEditors, VCLEditors, TypInfo, Controls, Graphics, ExtCtrls, Tabs, Dialogs, Forms,
{$IFDEF RX_D3} DsnConst, ExtDlgs, {$ELSE} LibConst, {$ENDIF}
{$IFDEF DCS}
{$IFDEF RX_D4} ImgEdit, {$ENDIF} {$IFDEF WIN32} ImgList, {$ENDIF}
{$ENDIF DCS}
{$IFDEF WIN32} RxRichEd, {$ENDIF} Menus, FiltEdit, StdCtrls, Buttons,
RxLConst, RxCtrls, RxGrids, CurrEdit, ToolEdit, HintProp, DateUtil,
PickDate, RxSplit, RxSlider, RxClock, Animate, RxCombos, RxSpin, Consts,
RxDice, RxSwitch, CheckItm, VCLUtils, RxColors, AniFile, RxGraph,
{$IFDEF USE_RX_GIF} RxGIF, GIFCtrl, {$ENDIF} RxHints, ExcptDlg, RxCConst,
FileUtil, RxDsgn;
{$IFNDEF RX_D3}
{ TDateProperty }
type
TDateProperty = class(TFloatProperty)
public
function GetValue: string; override;
procedure SetValue(const Value: string); override;
end;
function TDateProperty.GetValue: string;
begin
if GetFloatValue = NullDate then Result := ''
else Result := FormatDateTime(ShortDateFormat, GetFloatValue);
end;
procedure TDateProperty.SetValue(const Value: string);
begin
if Value = '' then SetFloatValue(NullDate)
else SetFloatValue(StrToDateFmt(ShortDateFormat, Value));
end;
{ TRxModalResultProperty }
type
TRxModalResultProperty = class(TModalResultProperty)
public
function GetValue: string; override;
procedure GetValues(Proc: TGetStrProc); override;
procedure SetValue(const Value: string); override;
end;
const
ModalResults: array[mrAll..mrYesToAll] of string = (
'mrAll',
'mrNoToAll',
'mrYesToAll');
function TRxModalResultProperty.GetValue: string;
var
CurValue: Longint;
begin
CurValue := GetOrdValue;
case CurValue of
Low(ModalResults)..High(ModalResults):
Result := ModalResults[CurValue];
else Result := inherited GetValue;
end;
end;
procedure TRxModalResultProperty.GetValues(Proc: TGetStrProc);
var
I: Integer;
begin
inherited GetValues(Proc);
for I := Low(ModalResults) to High(ModalResults) do
Proc(ModalResults[I]);
end;
procedure TRxModalResultProperty.SetValue(const Value: string);
var
I: Integer;
begin
if (Value <> '') then
for I := Low(ModalResults) to High(ModalResults) do
if CompareText(ModalResults[I], Value) = 0 then begin
SetOrdValue(I);
Exit;
end;
inherited SetValue(Value);
end;
{$ENDIF RX_D3}
function ValueName(E: Extended): string;
begin
if E = High(Integer) then Result := 'MaxInt'
else if E = Low(Integer) then Result := 'MinInt'
else if E = High(Longint) then Result := 'MaxLong'
else if E = Low(Longint) then Result := 'MinLong'
else if E = High(ShortInt) then Result := 'MaxShort'
else if E = Low(ShortInt) then Result := 'MinShort'
else if E = High(Word) then Result := 'MaxWord'
else Result := '';
end;
function StrToValue(const S: string): Longint;
begin
if CompareText(S, 'MaxLong') = 0 then Result := High(Longint)
else if CompareText(S, 'MinLong') = 0 then Result := Low(Longint)
else if CompareText(S, 'MaxInt') = 0 then Result := High(Integer)
else if CompareText(S, 'MinInt') = 0 then Result := Low(Integer)
else if CompareText(S, 'MaxShort') = 0 then Result := High(ShortInt)
else if CompareText(S, 'MinShort') = 0 then Result := Low(ShortInt)
else if CompareText(S, 'MaxWord') = 0 then Result := High(Word)
else Result := 0;
end;
{ TRxIntegerProperty }
type
TRxIntegerProperty = class(TIntegerProperty)
public
function GetValue: string; override;
procedure SetValue(const Value: string); override;
end;
function TRxIntegerProperty.GetValue: string;
begin
Result := ValueName(GetOrdValue);
if Result = '' then Result := IntToStr(GetOrdValue);
end;
procedure TRxIntegerProperty.SetValue(const Value: String);
var
L: Longint;
begin
L := StrToValue(Value);
if L = 0 then L := StrToInt(Value);
inherited SetValue(IntToStr(L));
end;
{ TRxFloatProperty }
type
TRxFloatProperty = class(TFloatProperty)
public
function GetValue: string; override;
procedure SetValue(const Value: string); override;
end;
function TRxFloatProperty.GetValue: string;
const
{$IFDEF WIN32}
Precisions: array[TFloatType] of Integer = (7, 15, 18, 18, 18);
{$ELSE}
Precisions: array[TFloatType] of Integer = (7, 15, 18, 18);
{$ENDIF}
begin
Result := ValueName(GetFloatValue);
if Result = '' then
Result := FloatToStrF(GetFloatValue, ffGeneral,
Precisions[GetTypeData(GetPropType)^.FloatType], 0);
end;
procedure TRxFloatProperty.SetValue(const Value: string);
var
L: Longint;
begin
L := StrToValue(Value);
if L <> 0 then SetFloatValue(L)
else SetFloatValue(StrToFloat(Value));
end;
{ TPaintBoxEditor }
type
TPaintBoxEditor = class(TDefaultEditor)
public
procedure EditProperty(const Prop: IProperty; var Continue: Boolean); override;
end;
procedure TPaintBoxEditor.EditProperty(const Prop: IProperty; var Continue: Boolean);
begin
if CompareText(Prop.GetName, 'OnPaint') = 0 then begin
Prop.Edit;
Continue := False;
end
else inherited EditProperty(Prop, Continue);
end;
{ TAnimatedEditor }
type
TAnimatedEditor = class(TComponentEditor)
private
FContinue: Boolean;
procedure CheckEdit(const Prop: IProperty);
procedure EditImage(Image: TAnimatedImage);
procedure LoadAniFile(Image: TAnimatedImage);
public
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
end;
procedure TAnimatedEditor.CheckEdit(const Prop: IProperty);
begin
try
if FContinue and (CompareText(Prop.GetName, 'GLYPH') = 0) then
begin
Prop.Edit;
FContinue := False;
end;
finally
//Prop.Free;
end;
end;
procedure TAnimatedEditor.EditImage(Image: TAnimatedImage);
var
Components: IDesignerSelections;
begin
Components := CreateSelectionList;
try
FContinue := True;
Components.Add(Component);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -