The Four-Function Calculator: Our First Simple Application

We can combine this understanding of statefulness and events to make our first simple QCubed Forms application.

This calculator is just a collection of two TextBox objects (one for each operand), a ListBox object containing the four arithmetic functions, a Button object to execute the operation, and a Label to view the result.

Note that there is no validation, checking, etc. currently in this Form. Any string data will be parsed by PHP to see if there is any numeric data, and if not, it will be parsed as 0. Dividing by zero will throw a PHP error.

Value 1:

Value 2:

Operation: