ABCButtons unit in PascalABC.NET
![]() |
Was this page created by accident or as a test? Please improve the educational quality of this page, and clarify what the intentions are on the discussion page so other people may contribute. The page might be able to remain at Wikibooks after 7 days when further development is likely.
Please consider notifying the author(s) with {{subst:Query notice|ABCButtons unit in PascalABC.NET|~~~~}} |
ABCButtons - is a PascalABC.NET unit intended for simple GUI application's creation.
![]() | This unit is currently deprecated and is not recommended for a usage. |
Controls
[edit | edit source]- ButtonABC - a button
ButtonABC class
[edit | edit source]Inheritance chain: ButtonABC > ABCObjects.UIElementABC > ABCObjects.RectangleABC > ABCObjects.BoundedObjectABC > ABCObjects.ObjectABC.
Constructor
[edit | edit source]Name | Way to memorize | Type | Description |
---|---|---|---|
x | x | integer | An X-coordinate of the button location |
y | y | integer | An Y-coordinate of the button location |
w | width | integer | A width of the button |
h | height | integer | A height of the button |
txt | text | string | A text on the button |
cl | color | GraphABC.Color | A color of the button |
Fields
[edit | edit source]Name | Type | Description |
---|---|---|
OnClick | procedure | A procedure called on the button click |
Properties
[edit | edit source]Inherited from base classes.
Examples
[edit | edit source]
Create a new button with Click me!
text on it:
new ButtonABC(0, 0, 200, 50, 'Click me!', clRed);
Examples
[edit | edit source]uses ABCButtons, GraphABC;
begin
var button := new ButtonABC(0, 0, 200, 50, 'Press me to change my color', clRed);
button.OnClick := procedure ->
begin
button.Color := clRandom();
button.FontColor := RGB(255 - button.Color.R, 255 - button.Color.G, 255 - button.Color.B);
end;
end.
uses GraphABC, ABCObjects, ABCButtons;
const
ButtonSize = 50;
BoxSize = 100;
MoveValue = 5;
begin
Window().Caption := 'Press buttons to translate the figure';
var left := new ButtonABC(0, 0, ButtonSize, ButtonSize, 'left', clRed);
var right := new ButtonABC(ButtonSize, 0, ButtonSize, ButtonSize, 'right', clYellow);
var up := new ButtonABC(ButtonSize * 2, 0, ButtonSize, ButtonSize, 'up', clGreen);
var down := new ButtonABC(ButtonSize * 3, 0, ButtonSize, ButtonSize, 'down', clBlue);
var rectangle := new RectangleABC(Window().Width div 2 - BoxSize div 2,
Window().Height div 2 - BoxSize div 2,
BoxSize, BoxSize, clGray);
left.OnClick := procedure() -> rectangle.MoveOn(-MoveValue, 0);
right.OnClick := procedure() -> rectangle.MoveOn(MoveValue, 0);
up.OnClick := procedure() -> rectangle.MoveOn(0, -MoveValue);
down.OnClick := procedure() -> rectangle.MoveOn(0, MoveValue);
end.