📄 hintprop.pas
字号:
{*******************************************************}
{ }
{ Delphi VCL Extensions (RX) }
{ }
{ Copyright (c) 1995 AO ROSNO }
{ }
{*******************************************************}
unit HintProp;
interface
{$I RX.INC}
uses RTLConsts, DesignIntf, DesignEditors, VCLEditors;
type
{ THintProperty }
THintProperty = class(TCaptionProperty)
public
function GetAttributes: TPropertyAttributes; override;
{$IFDEF WIN32}
function GetEditLimit: Integer; override;
{$ENDIF}
procedure Edit; override;
end;
implementation
{$IFDEF WIN32}
{$D-}
{$ENDIF}
uses SysUtils, Classes, {$IFDEF RX_D3} StrLEdit, {$ELSE} StrEdit, {$ENDIF}
TypInfo, Forms, Controls, rxStrUtils;
function THintProperty.GetAttributes: TPropertyAttributes;
begin
Result := inherited GetAttributes + [paDialog];
end;
{$IFDEF WIN32}
function THintProperty.GetEditLimit: Integer;
begin
if GetPropType^.Kind = tkString then
Result := GetTypeData(GetPropType)^.MaxLength
else Result := 1024;
end;
{$ENDIF}
procedure THintProperty.Edit;
var
Temp: string;
Comp: TPersistent;
I, Cnt: Integer;
begin
with TStrEditDlg.Create(Application) do
try
Comp := GetComponent(0);
if Comp is TComponent then
Caption := TComponent(Comp).Name + '.' + GetName
else Caption := GetName;
Temp := GetStrValue;
Cnt := WordCount(Temp, [#13, #10]);
for I := 1 to Cnt do
Memo.Lines.Add(ExtractWord(I, Temp, [#13, #10]));
Memo.MaxLength := GetEditLimit;
UpdateStatus(nil);
if ShowModal = mrOk then begin
Temp := Memo.Text;
while (Length(Temp) > 0) and (Temp[Length(Temp)] < ' ') do
System.Delete(Temp, Length(Temp), 1);
SetStrValue(Temp);
end;
finally
Free;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -