Ramiz Tariq
Ramiz Tariq

Reputation: 387

How to show number in result box oracle forms?

I am making calculator in oracle forms developer 11g

i want to show NUMBER in Result Display Box when button press (Button Label '1')

how to show number in display box?

Upvotes: 1

Views: 181

Answers (1)

Littlefoot
Littlefoot

Reputation: 142753

That would be the WHEN-BUTTON-PRESSED trigger, obviously.

What isn't that obvious is what number you are talking about. Suppose that your "calculator" adds two numbers you enter into two form items. Then you'd use

:block.result := :block.number_1 + :block.number_2;

[EDIT]

Aha; I think I understand what you mean. There are 10 buttons, labeled 0, 1, 2, ..., 9 so you'd want to enter value behind that button into an item.

Option I suggested in a comment works, but - what if you want to enter two, three or more digits number? You'd have to concatenate them. That requires 10 WHEN-BUTTON-PRESSED triggers, each for one digit.

For example:

-- WHEN-BUTTON-PRESSED on a button labeled '1'
:block.display_box := :block.display_box || '1';

-- WHEN-BUTTON-PRESSED on a button labeled '2'
:block.display_box := :block.display_box || '2';

and so forth

Upvotes: 1

Related Questions