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 |FormsABC unit in PascalABC.NET|~~~~}}
FormsABC - is a PascalABC.NET unit intended for simple GUI application's creation.
This unit is currently deprecated and is not recommended for a usage.
Button - a button
CheckBox - a checkbox
RadioButton - a radio button
IntegerField - a single line text box intended to keep integer values
RealField - a single line text box intended to keep real values
Field - a single line text box
TextBox - a multi line text box
TrackBar - a track bar
TextLabel - a label
ListBox - a list box
ComboBox - a combo box
MainMenu - a main menu
Type
Description
string
A text on the button
Name
Type
Description
Text
string
A text on the button
Width
integer
A width of the button
Name
Type
Description
Click
procedure
A procedure called on the button click
Create a new button with Click me!
text on it:
Type
Description
string
A text on the checkbox
Name
Type
Description
Checked
boolean
Whether the checkbox is checked
Create a new checkbox with Check me!
text on it:
new CheckBox ( 'Check me!' ) ;
uses System ;
uses FormsABC ;
const
Sum = '+' ;
Difference = '-' ;
Multiplication = '*' ;
Division = '/' ;
begin
mainForm . Width := 350 ;
mainForm . Height := 120 ;
mainForm . Title := 'Calculator' ;
mainForm . IsFixedSize := true ;
var first := new IntegerField ( 'First:' , 100 ) ;
var second := new IntegerField ( 'Second:' , 100 ) ;
var result := new IntegerField ( 'Result:' , 100 ) ;
LineBreak () ;
var actions := new ComboBox () ;
actions . Items . Add ( Sum ) ;
actions . Items . Add ( Difference ) ;
actions . Items . Add ( Multiplication ) ;
actions . Items . Add ( Division ) ;
actions . SelectedIndex := 0 ;
var calculate := new Button ( 'Calculate' ) ;
calculate . Click += () ->
try
case actions . SelectedValue . ToString ()[ 1 ] of
Sum : result . Value := first . Value + second . Value ;
Difference : result . Value := first . Value - second . Value ;
Multiplication : result . Value := first . Value * second . Value ;
Division :
if second . Value <> 0 then
result . Value := first . Value div second . Value ;
end ;
except on Exception do
end ;
end .