[comp.sys.amiga.tech] Gadgets and requesters: trying to get started

jack@cca.CCA.COM (Jack Orenstein) (04/19/88)

I'm trying to learn about requesters and gadgets with the help of Peck's
book and I'm having some trouble. The information in chapter 5 seems
incomplete. In particular, I can't find any discussion of how to attach
a requester to a window. The paint program in chapter 5 doesn't seem to
do it, and the topic isn't discussed in the text. Yet the window data
structure in intuition.h has a FirstRequest field, a DMRequest field
(what does the DM stand for?), and a ReqCount field. I've tried filling
in the FirstRequest field and the ReqCount field, but the requester does
not appear. Also, how do the sizes of the requester and any attached
gadgets relate? Are gadget coordinates relative to the requester or to
the window containing the requester?

Are there other fields (in the requester or window) that have to be set?
Are there commands for displaying and clearing requesters? Are there any
books with more complete information?

Jack Orenstein

thomson@utah-cs.UUCP (Richard A Thomson) (04/19/88)

In article <27194@cca.CCA.COM> jack@cca.CCA.COM (Jack Orenstein) writes:
>... In particular, I can't find any discussion of how to attach
>a requester to a window.

I suggest reading chapter 7 in the Intuition manual: "Requesters and Alters".
From there I got the following info: (Using Requesters, pg. 7-7)

	1. Declare or allocate a Requester structure
	2. Initialize the structure with a call to InitRequester()
	3. Fill out the Requester with your specs for gadgets, text, borders
	   and imagery.
	4. If you are using the IDCMP for input, decide whether to use the
	   special functions provided.
	5. Display the requester by calling either:
	   * Request(), or
	   * SetDMRequest() so the user can bring up the requester.

>... the window data
>structure in intuition.h has a FirstRequest field, a DMRequest field
>(what does the DM stand for?), and a ReqCount field.

    The DMRequest field stands for "double menu request".  This is a special
    kind of requester that can be attached to a window through SetDMRequest().
    The requester is brought up every time the user double-clicks on the menu
    button.

>Also, how do the sizes of the requester and any attached
>gadgets relate? Are gadget coordinates relative to the requester or to
>the window containing the requester?

    Gadgets always have their coordinates relative to the object (window,
    requester, or screen).  In the Intuition manual, on pg. 5-8 under
    "Gadget Select Box", it says ``The location is an offset from one of the
    corners of the display element (window, screen, or requester) that contains
    the gadget."

>Are there other fields (in the requester or window) that have to be set?

    Yes.  There are fields you have to set in the requester structure, depending
    on what kind of requester you want to make.

>Are there commands for displaying and clearing requesters? Are there any
>books with more complete information?
>
>Jack Orenstein

As always, the true source of information on this stuff is the Intuition
Manual (some people don't like it, but I think its pretty clear on most stuff)
and the ROM Kernel Manuals.  Perhaps Rob himself would like to clarify where
to find the stuff in his book(s) [I don't have them :-].
-- 
					-- Rich
Richard Thomson		3190 MEB, University of Utah, Salt Lake City, UT 84112
thomson@cs.utah.edu	(801) 584-4555: Talk to a machine, they're lonely.

cmcmanis%pepper@Sun.COM (Chuck McManis) (04/20/88)

In article <27194@cca.CCA.COM> jack@cca.CCA.COM (Jack Orenstein) writes:
> In particular, I can't find any discussion of how to attach a requester 
> to a window. 

Call Request(), it is documented in the Intuition Manual. It returns
TRUE if your requester could be rendered. After that all input to 
your event loop comes from the requester until the user selects an
ENDGADGET type gadget or your code calls EndRequest().

> DMRequest field (what does the DM stand for?)

DM stands for 'Double Menu'. With the routine SetDMRequest() you can
arm Intuition to display a requester of your choice when the user
double clicks on the *Menu* button. 

> Also, how do the sizes of the requester and any attached gadgets relate? 

A requester must be large enough to hold all of the gadgets in it. 

> Are gadget coordinates relative to the requester or to the window 
> containing the requester?

Gadget Coordinates are relative to the top left corner of the requester.

>Are there any books with more complete information?

Yes, the Intuition Manual, the section on Requesters, lists the various
routines you can call that affect requesters.



--Chuck McManis
uucp: {anywhere}!sun!cmcmanis   BIX: cmcmanis  ARPAnet: cmcmanis@sun.com
These opinions are my own and no one elses, but you knew that didn't you.

jgh2@cisunx.UUCP (John G. Hardie) (04/20/88)

In article <27194@cca.CCA.COM> jack@cca.CCA.COM (Jack Orenstein) writes:
>
>I'm trying to learn about requesters and gadgets with the help of Peck's
>book and I'm having some trouble. The information in chapter 5 seems
>incomplete. In particular, I can't find any discussion of how to attach
>a requester to a window. The paint program in chapter 5 doesn't seem to
>do it, and the topic isn't discussed in the text. Yet the window data

The easiest way, if you just want to put up simple requesters is to use
the intuition function AutoRequest.  This is called as follows:

AutoRequest(wi,bt,pt,nt,pf,nf,w,h)	where:
	wi	->	pointer to window struct.
	bt	-> 	pointer to intuitext structure that contains the
			main text of the requester.
	pt	->	pointer to intuitext struct that contains the
			text for the positive hit box
	nt	-> 	pointer to intuitext...negative hit box
	pf	->	IDCMP flags that you want set for the positive
			text.
	nf	-> 	same for negative text
	w	->	width of requester
	h	-> 	height of requester.

This routine will build and display a simple requester (similar to
the 'insert disk' type of requester), and it's fairly easy to use.

If you want  more details on this call, or more info on more flexible
requesters, get the Addison Wesley Intuition Reference Manual.	

>structure in intuition.h has a FirstRequest field, a DMRequest field
>(what does the DM stand for?), and a ReqCount field. I've tried filling
		^^
		Double Menu... This type of requester is attached
( in a sense ) to a double click of the mouse menu button.  If you 
define one of these requesters and double click the menu button while in
the active region of the window, the requester will appear like magic.
(see intuition man. for more details)

>in the FirstRequest field and the ReqCount field, but the requester does
>not appear. Also, how do the sizes of the requester and any attached
>gadgets relate? Are gadget coordinates relative to the requester or to
>the window containing the requester?

- if a gadget is attached to a requester, the coordinates are relative
(usually) to the top left corner of the requester.  The size of the
requester relative to the window is set by you, usually the gadgets
are placed absolutely relative to the requester, but you don't have
to do it this way (e.g. GRELBOTTOM, GRELWIDTH and others of that ilk -
sorry, these are flags that you can set in the gadget structure that
will make the gadget position and size relative to the size of the 
requester - again, see intuition manual for details)

>
>Are there other fields (in the requester or window) that have to be set?
>Are there commands for displaying and clearing requesters? Are there any
>books with more complete information?
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

	guess what??? Intuition Manual.... :-)

>
>Jack Orenstein

Hope this helps,
John

-- 
John Hardie - Physics Dept  U. Of Pittsburgh  Pittsburgh, Pa 15260
jgh2@cisunx.UUCP, jgh2@{unix or vms}.Cis.Pittsburgh.Edu, jgh2@PITTVMS.BITNET

	An Ounce Of Inaccuracy Saves A Pound Of Explanation