18.10.2014 Views

Object-oriented Software in Ada 95

Object-oriented Software in Ada 95

Object-oriented Software in Ada 95

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

A Text user <strong>in</strong>terface 317<br />

W<strong>in</strong>dow_Start;<br />

--Start the user <strong>in</strong>teraction<br />

The procedure W<strong>in</strong>dow_Epilog closes down the system. This must be called outside the block <strong>in</strong> which the<br />

<strong>in</strong>stances of the w<strong>in</strong>dows were elaborated. This is to allow the f<strong>in</strong>alization code to be called on the elaborated<br />

w<strong>in</strong>dows before W<strong>in</strong>dow_Epilog is called.<br />

end;<br />

W<strong>in</strong>dow_Epilogue;<br />

end Ma<strong>in</strong>;<br />

--Close w<strong>in</strong>dow system<br />

22.3.2 Putt<strong>in</strong>g it all together<br />

When compiled with the TUI API library code, the screen display with added annotations to show which call of<br />

framework was used, together with position <strong>in</strong>formation is shown below:<br />

framework( title, 20, 1, 36, 5 );<br />

(20,1)<br />

+----------------------------------+<br />

| |<br />

| Miles to kilometres |<br />

| |<br />

+----------------------------------+<br />

(5,10) (30,10)<br />

#--------------------+ +----------------------------------+<br />

|Dialog| Miles | | |<br />

|--------------------| | |<br />

|* | | (30+36-1,10+5-1) |<br />

+--------------------+ +----------------------------------+<br />

framework( result, 30, 10, 36, 5 );<br />

framework(<strong>in</strong>put, 5, 10, 22, "Miles", user_<strong>in</strong>put'Access);<br />

After a user has typed <strong>in</strong> a distance of 50 miles to be converted to kilometres the screen will display:<br />

+----------------------------------+<br />

| |<br />

| Miles to kilometres |<br />

| |<br />

+----------------------------------+<br />

#--------------------+ +----------------------------------+<br />

|Dialog| Miles | |Distance <strong>in</strong> miles = 50.00 |<br />

|--------------------| |Distance <strong>in</strong> Kms = 80.47 |<br />

|50.0* | | |<br />

+--------------------+ +----------------------------------+<br />

22.4 The menu system<br />

The menu system is based on the metaphor of a menu title bar at the top of the screen which changes as new menu<br />

options are selected. When a user selects away from the menu bar, the menu bar is returned to the top level of the<br />

menu hierarchy. The menu system is activated by typ<strong>in</strong>g the switch character ESC.<br />

© M A Smith - May not be reproduced without permission

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!