📄 formwval.pas
字号:
unit FormWVal;
interface
uses
Classes, Forms, Windows, Dialogs, ExptIntf, ToolIntf,
FileCtrl, SysUtils, EditIntf;
type
TFormWithValue = class (TForm)
private
fValue: Integer;
fOnChangeValue: TNotifyEvent;
procedure SetValue (Value: Integer);
published
property Value: Integer
read fValue write SetValue;
property OnChangeValue: TNotifyEvent
read fOnChangeValue write fOnChangeValue;
end;
TFormWithValueExpert = class (TIExpert)
public
function GetStyle: TExpertStyle; override;
function GetName: string; override;
function GetAuthor: string; override;
function GetComment: string; override;
function GetPage: string; override;
function GetGlyph: HICON; override;
function GetState: TExpertState; override;
function GetIDString: string; override;
function GetMenuText: string; override;
procedure Execute; override;
end;
procedure Register;
implementation
uses
DsgnIntf;
procedure TFormWithValue.SetValue (Value: Integer);
begin
if Value <> fValue then
begin
fValue := Value;
if Assigned (fOnChangeValue) then
fOnChangeValue (self);
end;
end;
// "standard" project expert
function TFormWithValueExpert.GetStyle: TExpertStyle;
begin
// show up in the Help menu
Result := esStandard;
end;
function TFormWithValueExpert.GetName: String;
begin
// official name
Result := 'Form With Value Wizard'
end;
function TFormWithValueExpert.GetAuthor: string;
begin
Result := 'Marco and Tim';
end;
function TFormWithValueExpert.GetComment: String;
begin
Result := 'TFormWithValueExpert Wizard';
end;
function TFormWithValueExpert.GetPage: string;
begin
Result := '';
end;
function TFormWithValueExpert.GetGlyph: HICON;
begin
Result := 0;
end;
function TFormWithValueExpert.GetState: TExpertState;
begin
Result := [esEnabled];
end;
function TFormWithValueExpert.GetIDString: String;
begin
// must be unique
Result := 'DDHandbook.FormWithValueWizard'
end;
function TFormWithValueExpert.GetMenuText: String;
begin
// the text of the menu item
Result := '&Form With Value Wizard'
end;
procedure TFormWithValueExpert.Execute;
var
ModuleName, FormName, FileName: string;
ModIntf: TIModuleInterface;
begin
ToolServices.GetNewModuleAndClassName (
'FormWithValue', ModuleName, FormName, FileName);
ModIntf := ToolServices.CreateModuleEx (FileName, FormName,
'FormWithValue', '', nil, nil,
[cmNewForm, cmAddToProject, cmUnNamed]);
ModIntf.ShowSource;
ModIntf.ShowForm;
ModIntf.Release;
end;
procedure Register;
begin
RegisterCustomModule (TFormWithValue, TCustomModule);
RegisterLibraryExpert(TFormWithValueExpert.Create);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -