📄 mmleds.pas
字号:
{$IFDEF WIN32}
{$IFDEF DELPHI3}
procedure TMMLEDSpin.GetChildren(Proc: TGetChildProc; Root: TComponent);
{$ELSE}
procedure TMMLEDSpin.GetChildren(Proc: TGetChildProc);
{$ENDIF}
begin
end;
{$ENDIF}
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.WMSetFocus(var Message: TWMSetFocus);
begin
if TabStop AND FButton.CanFocus AND (GetFocus <> FButton.Handle) then
FButton.SetFocus;
Message.Result := 0;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.Click;
begin
if TabStop AND FButton.CanFocus AND (GetFocus <> FButton.Handle) then
FButton.SetFocus;
inherited Click;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.BtnClick(Sender: TObject);
begin
Click;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.BtnDblClick(Sender: TObject);
begin
DblClick;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.MsDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
MouseDown(Button, Shift, X, Y);
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.MsUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
MouseUp(Button, Shift, X, Y);
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.MsMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
MouseMove(Shift, X, Y);
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetTabStop(aValue: Boolean);
begin
inherited TabStop := aValue;
FButton.TabStop := aValue;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetTabStop: Boolean;
begin
Result := inherited TabStop;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.AdjustSize (var W, H: integer);
begin
FButton.Height := 1; { reset the SpinButton size standard }
FButton.Width := 1;
W := FLEDPanel.Width + FButton.Width + FSpace;
H := Max(FButton.Height,FLEDPanel.Height);
FButton.SetBounds(W-FButton.Width,0,FButton.Width,H);
FLEDPanel.SetBounds(0,H-FLEDPanel.Height,FLEDPanel.Width,FLEDPanel.Height);
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.AdjustBounds;
var
W, H: Integer;
begin
W := Width;
H := Height;
AdjustSize (W, H);
if (W <> Width) or (H <> Height) then
inherited SetBounds(Left, Top, W, H)
else Invalidate;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.WMSize(var Message: TWMSize);
begin
inherited;
AdjustBounds;
Message.Result := 0;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLedSpin.SetBounds(aLeft, aTop, aWidth, aHeight: Integer);
var
W, H: Integer;
begin
W := aWidth;
H := aHeight;
AdjustSize (W, H);
inherited SetBounds (aLeft, aTop, W, H);
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.GetChanged;
begin
AdjustBounds;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.UpClick(Sender: TObject);
begin
if Assigned(FOnUpClick) then FOnUpClick(Self);
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.DownClick(Sender: TObject);
begin
if Assigned(FOnDownClick) then FOnDownClick(Self);
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.ChildChange(Sender: TObject);
begin
if (csLoading in ComponentState) or
(csReading in ComponentState) then exit;
if Sender = FButton then
Value := FButton.Value;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.Change;
begin
if (csLoading in ComponentState) or
(csReading in ComponentState) then exit;
if assigned(FOnChange) then FOnChange(Self);
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetSpace(aValue: integer);
begin
if (aValue <> FSpace) then
begin
FSpace := aValue;
AdjustBounds;
end;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetLEDBevel(aBevel: TMMBevel);
begin
FLEDPanel.Bevel := aBevel;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetLEDBevel: TMMBevel;
begin
Result := FLEDPanel.Bevel;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetNumDigits(aValue: integer);
begin
FLEDPanel.NumDigits := aValue;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetNumDigits: integer;
begin
Result := FLEDPanel.NumDigits;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetLEDSpace(aValue: integer);
begin
FLEDPanel.LEDSpace := aValue;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetLEDSpace: integer;
begin
Result := FLEDPanel.LEDSpace;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLedSpin.SetColor(aValue: TColor);
begin
FLEDPanel.Color := aValue;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetColor: TColor;
begin
Result := FLEDPanel.Color;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetLEDColor(aValue: TColor);
begin
FLEDPanel.LEDColor := aValue;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetLEDColor: TColor;
begin
Result := FLEDPanel.LEDColor;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetInactiveColor(aValue: TColor);
begin
FLEDPanel.InactiveColor := aValue;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetInactiveColor: TColor;
begin
Result := FLEDPanel.InactiveColor;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetDrawInactive(aValue: Boolean);
begin
FLEDPanel.DrawInactive := aValue;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetDrawInactive: Boolean;
begin
Result := FLEDPanel.DrawInactive;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetEnabled(aValue: Boolean);
begin
inherited Enabled := aValue;
FButton.Enabled := aValue;
FLEDPanel.Enabled := aValue;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetEnabled: Boolean;
begin
Result := inherited Enabled;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetSize(aValue: TMMLEDSize);
begin
FLEDPanel.DigitSize := aValue;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetSize: TMMLEDSize;
begin
Result := FLEDPanel.DigitSize;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetZeroBlank(aValue: Boolean);
begin
FLEDPanel.ZeroBlank := aValue;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetZeroBlank: Boolean;
begin
Result := FLEDPanel.ZeroBlank;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetIncrement(aValue: Longint);
begin
FButton.Increment := aValue;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetIncrement: Longint;
begin
Result := FButton.Increment;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetUpGlyph(Value: TBitmap);
begin
FButton.UpGlyph := Value;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetUpGlyph: TBitmap;
begin
Result := FButton.UpGlyph;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetDownGlyph(Value: TBitmap);
begin
FButton.DownGlyph := Value;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetDownGlyph: TBitmap;
begin
Result := FButton.DownGlyph;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetDownNumGlyphs(Value: TNumGlyphs);
begin
FButton.DownNumGlyphs := Value;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetDownNumGlyphs: TNumGlyphs;
begin
Result := FButton.DownNumGlyphs;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetUpNumGlyphs(Value: TNumGlyphs);
begin
FButton.UpNumGlyphs := Value;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetUpNumGlyphs: TNumGlyphs;
begin
Result := FButton.UpNumGlyphs;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetButtonFace(Value: Boolean);
begin
if (Value <> FButton.ButtonFace) then
begin
FButton.ButtonFace := Value;
AdjustBounds;
end;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetButtonFace: Boolean;
begin
Result := FButton.ButtonFace;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetMiddleButton(Value: Boolean);
begin
if (Value <> FButton.MiddleButton) then
begin
FButton.MiddleButton := Value;
AdjustBounds;
end;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetMiddleButton: Boolean;
begin
Result := FButton.MiddleButton;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetSpinBevel(aValue: TMMBevel);
begin
FButton.Bevel := aValue;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetSpinBevel: TMMBevel;
begin
Result := FButton.Bevel;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetMinValue(aValue: Longint);
begin
FLEDPanel.MinValue := aValue;
FButton.MinValue := aValue;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
function TMMLEDSpin.GetMinValue: Longint;
begin
Result := FLEDPanel.MinValue;
end;
{-- TMMLEDSpin -----------------------------------------------------------}
procedure TMMLEDSpin.SetMaxValue(aValue: Longint);
begin
FLEDPanel.MaxValue := aValue;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -