home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
dev
/
cmanual-3.0.lha
/
CManual
/
Intuition
/
Requesters
/
Requesters.doc
< prev
next >
Wrap
Text File
|
1993-10-12
|
24KB
|
669 lines
5 REQUESTERS
5.1 INTRODUCTION
Requesters are boxes filled with some sort of information which
the user need to respond to. It can be as simple as a question
to insert a disk in the internal drive, or a fully functional
file requester. Requesters are like small windows with some
gadgets connected to it, and they will first disappear when the
user has "satisfied the request".
5.2 DIFFERENT TYPES OF REQUESTERS
There exist three different types of requesters:
- System requesters
- Application requesters
- Double-menu requesters
5.2.1 SYSTEM REQUESTERS
System requesters are opened and maintained by Intuition, and
your program has no control over them. If the user, for
example, is trying to load a file from drive df1:, and there is
no disk present, the operating system would open the following
request:
-----------------------------------
| System Request ============[*][*]
-----------------------------------
| No disk present | |
| in unit 1 | |
| | |
| --------- ---------- | |
| | Retry | | Cancel | | |
| --------- ---------- | |
--------------------------------[*]
One important thing about System requesters is that they are
like small windows. You can move around them, push them behind
or in front of other windows/requesters, and resize them.
5.2.2 APPLICATION REQUESTERS
This is the type of requester your program can open. They can
be of any size (limited only by the size of the screen), and
can be as simple or as complicated as you want.
If you only want a Yes/No (True/False) requester you can call
the function AutoRequest(), and Intuition will open and take
care of the rest. If you on the other hand want a more
sophisticated requester you need to declare and initialize a
Requester structure with your requirements, and call the
function Request().
It is important to notice that an Application requester can not
be moved around, resized etc (the window containing the
requester can still, of course, be moved around and resized).
It is only the System requesters, and the very simple
requesters opened by the AutoRequest function, which acts like
small windows.
There is also one other big difference. When an Application
requester has been activated the user can no longer select
gadgets connected to the window. The window has been "frozen".
Eg. try Example4, and you will notice that you can not select
the close-window gadget as long as the requester is active. On
the other hand, if a System requester has been activated, the
user can still click on the close-window gadget, and a
CLOSEWINDOW message is sent.
5.2.3 DOUBLE-MENU REQUESTERS
Double-menu requesters are like normal Application requesters
except that they will open first, and only, when the user
double-clicks on the mouse menu button. To create a Double-menu
requester you need to declare and initialize a Requester
structure, and then call the function SetDMRequest(). Whenever
the user from now on double-clicks on the menu button on the
mouse, the requester will be opened. Call the function
ClearDMRequest() when you do not want the user to be able to
open the requester any more.
Only one DM-requester may be connected to each window.
5.3 GRAPHICS FOR REQUESTERS
You can render a requester in two different ways. You can
either tell Intuition what you want, and everything is rendered
for you, or you can supply Intuition with your own customized
Bitmap (which has been rendered by yourself).
If you want Intuition to draw the requester for you, you only
need to decide what colour the background of the requester
should be filled with, and declare and initialize one or more
Border and IntuiText structures.
If you supply your own customized Bitmap Intuition will not
draw anything itself. That means that all gadget connected to
that requester does not need to have any Border/IntuiText/Image
structures connected to them, since Intuition will not bother
about them.
5.4 POSITION
The requester can either be positioned relative to the top left
corner of the window, or relative to the pointer position. If
you want to position the requester relative to the window, you
simply set the LeftEdge and TopEdge variables as desired. If
you, on the other hand, want it relative to the pointer
position, set the POINTREL flag, and initialize RelLeft and
RelTop as desired.
5.5 REQUESTERS AND GADGETS
When you create a requester, except when you call the function
AutoRequest(), you need to connect at least one gadget to the
requester. Gadgets connected to a requester works exactly the
same as gadgets connected to a window but with two important
differences:
1. Every gadget connected to a requester MUST have the
REQGADGET flag set in the GadgetType field.
2. At least one gadget must satisfy the request, which means at
least one gadget must have the ENDGADGET flag set in the
Activation field. (Once a gadget with an ENDGADGET flag set
is selected, the requester is satisfied, and will close.)
Remember that the user should always be able to find a safe way
to leave the requester without affecting anything. The "way out
gadget" (CANCEL, RESUME etc) should also always be placed on
the right side in the requester. Here is an example:
---------------------------------------
| System Request ================[*][*]
---------------------------------------
| Do you really want to quit? | |
| | |
| | |
| ------- ------ | |
| | Yes | | No | | |
| ------- ------ | |
------------------------------------[*]
Note that the Yes/True/Retry button is always on the left side
and that the No/False/Cancel button is always on the right side.
IMPORTANT! Make sure that the Gadgets are inside the
requester, since Intuition will not do any boundary checking.
5.6 SIMPLE REQUESTERS
If you just want a simple requester with a True/False (or just
False) option, you can use the function AutoRequest(). You give
Intuition some information about how the requester should look
like (height, text etc), and Intuition takes care of everything
else. It opens the requester, put your program to rest, and
when finished, returns a boolean value which tells your program
what the user selected. If the user selected the left gadget
(positive) it returns TRUE, and if the user selected the right
gadget (negative) it returns FALSE.
Example:
result = AutoRequest( window, info_text, pos_text, neg_text,
pos_IDCMP, neg_IDCMP, width, height );
window: Pointer to a window if there exist one, else NULL.
info_text: Pointer to an IntuiText structure containing the
"body text".
pos_text: Pointer to an IntuiText structure containing the
"positive text". Eg: "TRUE", "YES", "RETRY" etc.
(Optional)
neg_text: Pointer to an IntuiText structure containing the
"negative text". Eg: "FALSE", "NO", "CANCEL" etc.
pos_IDCMP: The IDCMP flags which satisfy the "positive"
gadget. (The flag RELVERIFY is already set.)
pos_IDCMP: The IDCMP flags which satisfy the "negative"
gadget. (The flag RELVERIFY is already set.)
width: How many pixels wide the requester should be.
height: How many lines high the requester should be.
5.7 OPEN A REQUESTERS
If you want to use a more complicated requester instead of the
Simple requester you need to:
1. Declare and initialize a Requester structure with your
requirements.
2. Declare and initialize the Gadget structures which are
going to be connected to the requester.
3. Call the function Request() in order to display the
requester as a normal requester, or call the function
SetDMRequest() to enable the user to bring up the requester
as a Double-menu requester.
5.7.1 INITIALIZE A REQUESTER
If you want to use a requester you need to declare and
initialize a Requester structure which look like this:
struct Requester
{
struct Requester *OlderRequest;
SHORT LeftEdge, TopEdge;