Sign in Join
Wiki copytemporary

TUpDown

English · Français · Suomi · Русский · 中文(中国)

The TUpDown component is two-button control that assists in increment/decrement of some value as determined by its Min and Max and Increment properties. The TUpDown component appears with two arrow buttons pointing up (next) and down (previous), respectively. Min and Max properties are used to set the minimum and maximum values of the TUpDown. The values of the TUpDown component are Smallint numbers. Property Position represents the currently selected value. If property ArrowKeys is True, the TUpDown component can be operated by the keyboard's arrow keys, which would simulate a click on the next or previous button. The Asscociate property may link to some other control that gets its value-change instruction from the TUpDown. TUpDown is found on the the Common Controls tab of the Component Palette.

Runtime creating

Here's a simple example creating a TUpDown component at runtime.
First create a form and put a TEdit component.

pascal
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ComCtrls;

type

  { TForm1 }

  TForm1 = class(TForm)
    Edit1: TEdit;
    procedure FormCreate(Sender: TObject);
  private

  public

  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.FormCreate(Sender: TObject);
var
  UpDown1: TUpDown;
begin
  UpDown1:= TUpDown.Create(Self);
  UpDown1.Parent:=Self;
  UpDown1.Min := -100;
  UpDown1.Max := 100;
  UpDown1.Associate := Edit1;
end;

end.

see also


From the Free Pascal wiki, page "TUpDown", as it stood on 2019-11-21 after a change by Djzepi, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.