home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 13
/
AACD13.ISO
/
AACD
/
Resources
/
System
/
BoingBag1
/
Contributions
/
Workbench
/
RexxArpLib3p6
/
src
/
sreq
/
reqtest.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-06-17
|
4KB
|
130 lines
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <functions.h>
#include <simpreq.h>
struct IntuitionBase *IntuitionBase = NULL;
struct GfxBase *GfxBase = NULL;
static struct SimpleRequester s;
static struct ReqPens reqp;
static char *prompts[SR_MAXPROMPTS];
void main(void)
{
long result;
int i;
if (!SReqOpenLibs())
{
printf("Couldn't open Graphics or Intuition\n");
exit(0);
}
s.sr_Prompt = prompts;
for (i = 0; i < SR_MAXPROMPTS; i++)
s.sr_Prompt[i] = NULL;
s.sr_x = 50;
s.sr_y = 50;
s.sr_Screen = NULL;
s.sr_PenList = NULL;
result = SimpleRequest(&s);
printf("result is %lx with the string: %s, error %d\n", result,
(s.sr_String ? s.sr_String : " "), s.sr_ErrorCode);
s.sr_Prompt[0] = malloc(255);
strcpy(s.sr_Prompt[0], "This is a test");
s.sr_x = 150;
s.sr_y = 100;
s.sr_PenList = &reqp;
reqp.reqp_BlockPen = 3;
reqp.reqp_DetailPen = 2;
reqp.reqp_BackPen = 1;
reqp.reqp_PromptPen = 2;
reqp.reqp_BoxPen = 2;
reqp.reqp_ShadowPen = 3;
reqp.reqp_OkayPen = 0;
reqp.reqp_CancelPen = 2;
result = SimpleRequest(&s);
printf("result is %lx with the string: %s, error %d\n", result,
(s.sr_String ? s.sr_String : " "), s.sr_ErrorCode);
s.sr_Prompt[1] = malloc(255);
s.sr_Prompt[2] = malloc(255);
strcpy(s.sr_Prompt[1], "This is another test");
strcpy(s.sr_Prompt[2], "This is another test, but this is a long one");
s.sr_x = 0;
s.sr_y = 0;
reqp.reqp_BackPen = 1;
reqp.reqp_PromptPen = 2;
reqp.reqp_BoxPen = 2;
reqp.reqp_ShadowPen = 3;
reqp.reqp_OkayPen = 2;
reqp.reqp_CancelPen = 3;
result = SimpleRequest(&s);
printf("result is %lx with the string: %s, error %d\n", result,
(s.sr_String ? s.sr_String : " "), s.sr_ErrorCode);
s.sr_Prompt[3] = malloc(255);
s.sr_Prompt[4] = malloc(255);
s.sr_Prompt[5] = malloc(255);
s.sr_Prompt[3][0] = '\0';
s.sr_Prompt[4][0] = '\0';
strcpy(s.sr_Prompt[5], "This is another test");
s.sr_x = 50;
s.sr_y = 50;
reqp.reqp_BackPen = 2;
reqp.reqp_PromptPen = 1;
reqp.reqp_BoxPen = 3;
reqp.reqp_ShadowPen = 0;
reqp.reqp_OkayPen = 1;
reqp.reqp_CancelPen = 3;
result = SimpleRequest(&s);
printf("result is %lx with the string: %s, error %d\n", result,
(s.sr_String ? s.sr_String : " "), s.sr_ErrorCode);
s.sr_String = malloc(255);
s.sr_String[0] = '\0';
result = SimpleRequest(&s);
printf("result is %lx with the string: %s, error %d\n", result,
(s.sr_String ? s.sr_String : " "), s.sr_ErrorCode);
s.sr_Okay = malloc(255);
strcpy(s.sr_Okay, "Yup, do it");
strcpy(s.sr_String, "This is the default text");
result = SimpleRequest(&s);
printf("result is %lx with the string: %s, error %d\n", result,
(s.sr_String ? s.sr_String : " "), s.sr_ErrorCode);
s.sr_Cancel = malloc(255);
strcpy(s.sr_Cancel, "No, don't\nyou dare, my friend");
result = SimpleRequest(&s);
printf("result is %lx with the string: %s, error %d\n", result,
(s.sr_String ? s.sr_String : " "), s.sr_ErrorCode);
s.sr_Okay = NULL;
s.sr_x = 100;
s.sr_y = 50;
reqp.reqp_BackPen = 1;
reqp.reqp_PromptPen = 2;
reqp.reqp_BoxPen = 2;
reqp.reqp_ShadowPen = 3;
reqp.reqp_OkayPen = 0;
reqp.reqp_CancelPen = 2;
result = SimpleRequest(&s);
printf("result is %lx with the string: %s, error %d\n", result,
(s.sr_String ? s.sr_String : " "), s.sr_ErrorCode);
s.sr_x = 100;
s.sr_y = 200;
result = SimpleRequest(&s);
printf("result is %lx with the string: %s, error %d\n", result,
(s.sr_String ? s.sr_String : " "), s.sr_ErrorCode);
SReqCloseLibs();
exit(0);
}