Skip to content

Improvement to SpinEdit code #149

@GrahamNZ

Description

@GrahamNZ

Sorry, I don't use Github much so don't know how to create a pull request. Here is an improvement to the value handling in Spin Edits:

procedure TfpgSpinEdit.EditExit(Sender: TObject);
begin
  if FEdit.Text = '' then
  begin
    if FMinValue>0 then
    begin
      FValue      := FMinValue;
      FEdit.Value := FValue;
    end else
    begin
      FValue      := 0;
      FEdit.Value := FValue;
    end;
  end
  else if StrToInt(FEdit.Text) > FMaxValue then
  begin
    FValue      := FMaxValue;
    FEdit.Value := FValue;
  end
  else if StrToInt(FEdit.Text) < FMinValue then
  begin
    FValue      := FMinValue;
    FEdit.Value := FValue;
  end else
    FValue      := FEdit.Value;
  EnableButtons;
end;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions