[comp.sys.amiga.tech] AutoRequest

joe@dayton.UUCP (Joseph P. Larson) (09/12/89)

I have a function that does the following:

	static struct IntuiText
		bodytext = {2, 1, JAM1, 20, 20, NULL, "Monitor Request Failed", NULL},
		notoktext = {2, 1, JAM1, 20, 30, NULL, "OK", NULL};
	
	AutoRequest(bdw, &bodytext, NULL, &notoktext, 0L, 0L, 260L, 80L);

My problem: the notoktext doesn't appear.  Everything works just fine, but
I can't get the text to appear.  I tried moving it around, tried using JAM2
drawmode.  Zippo.  Creates a little box to click in and everything.

So -- what's going on?

Also -- those two OL's are labeled "PositiveFlags" and "NegativeFlags".
Anyone care to give me a brief lesson on them?

-Joe
-- 
Life is a cabaret (old chum).
UUCP: rutgers!dayton!joe   (Picts 1-13 are   DHDSC - Joe Larson/MIS 1060
ATT : (612) 375-3537       now ready.)       700 on the Mall, Mpls, Mn. 55402

thad@cup.portal.com (Thad P Floryan) (09/13/89)

Joseph P. Larson writes about some problems and questions regarding the
AutoRequest() function.  Specifically:

"
static struct IntuiText
	bodytext = {2, 1, JAM1, 20, 20, NULL, "Monitor Request Failed", NULL},
	notoktext = {2, 1, JAM1, 20, 30, NULL, "OK", NULL};
	
	AutoRequest(bdw, &bodytext, NULL, &notoktext, 0L, 0L, 260L, 80L);

My problem: the notoktext doesn't appear.  Everything works just fine, but
I can't get the text to appear.  I tried moving it around, tried using JAM2
drawmode.  Zippo.  Creates a little box to click in and everything.

So -- what's going on?

Also -- those two OL's are labeled "PositiveFlags" and "NegativeFlags".
Anyone care to give me a brief lesson on them?

-Joe
"

At the end of this reply is a short sample program I did way back when I
"tested" all the functions; it's setup to be compiled with Manx and I just
briefly updated it as a prototype for another program that I'll be releasing
(inflicting? :-) shortly.

The PositiveFlags and NegativeFlags are the IDCMP bits for the event(s) you
want to act as if one selects the gadgets associated with the PositiveText or
NegativeText gadgets.  My example (below) doesn't use them, but if you need
some additional help, just ask!

As far as your text not appearing, suggest you modify your Intuitext's
LeftEdge and TopEdge values to be the same as in my example; the values are
offsets from containing imagery; your 20 and 30 puts the text outside the
display area of the requester (down and to the right).  Make them 0 and 0 and
your text WILL be visible (and will overstrike the gadget's box :-)

Notice also my use of JAM2 drawmode in the IntuiText data structures; this
causes my requester example to precisely mimic the standard "System Request".

And, as a final suggestion, be SURE the ``NULL'' you're passing as an argument
to AutoRequest()is properly cast to a longword; I'd suggest using (long)NULL
to assure compatibility with any compiler for the Amiga.

Another idea you may find useful are the two #defines (REQACTWIN and REQWBWIND)
which can be used for different requester window activation.  Using REQACTWIN
brings up a requester on the current active window (which is useful for those
programs that use custom screens; using REQWBWIND (as the window pointer arg
to AutoRequest()) puts the requester on the WorkBench screen.

Thad

Thad Floryan [ thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]

-------------------- begin of included example --------------------

#include <exec/types.h>
#include <exec/exec.h>
#include <exec/execbase.h>
#include <functions.h>
#include <graphics/gfxbase.h>
#include <intuition/intuition.h>
#include <intuition/intuitionbase.h>
#include <stdio.h>

struct GfxBase		*GfxBase;
struct IntuitionBase	*IntuitionBase;

struct IntuiText reqmsg3 = {
	0, 1, JAM2,			/* FrontPen, BackPen, DrawMode */
	50, 26, NULL,			/* LeftEdge, TopEdge, ITextFont */
	(UBYTE *)"\"PRT:\" cannot be opened.",
	NULL				/* NextText */
};

struct IntuiText reqmsg2 = {
	0, 1, JAM2,			/* FrontPen, BackPen, DrawMode */
	50, 16, NULL,			/* LeftEdge, TopEdge, ITextFont */
	(UBYTE *)"Printer is not ready, or",
	&reqmsg3			/* NextText */
};

struct IntuiText reqmsg = {
	0, 1, JAM2,			/* FrontPen, BackPen, DrawMode */
	16, 6, NULL,			/* LeftEdge, TopEdge, ITextFont */
	(UBYTE *)"Message from dprt:",
	&reqmsg2			/* NextText */
};

struct IntuiText reqyes = {
	0, 1, JAM2,			/* FrontPen, BackPen, DrawMode */
	6, 3, NULL,			/* LeftEdge, TopEdge, ITextFont */
	(UBYTE *)"Retry ",
	NULL				/* NextText */
};

struct IntuiText reqno = {
	0, 1, JAM2,			/* FrontPen, BackPen, DrawMode */
	6, 3, NULL,			/* LeftEdge, TopEdge, ITextFont */
	(UBYTE *)"Cancel",
	NULL				/* NextText */
};

#define REQACTWIN (IntuitionBase->ActiveWindow)	/* Req. take window title */
#define REQWBWIND ((long)NULL)	/* Req. in WB window as "SYSTEM REQUEST" */

main()
{
	int status = 1;

	GfxBase = (struct GfxBase *)
		OpenLibrary("graphics.library", 0L);

	IntuitionBase = (struct IntuitionBase *)
		OpenLibrary("intuition.library", 0L);

	while (status)
		status = AutoRequest(REQWBWIND,
			&reqmsg, &reqyes, &reqno, 0L, 0L, 320L, 72L);

	CloseLibrary(IntuitionBase);
	CloseLibrary(GfxBase);
}

-------------------- end of included example --------------------