ahinds@hvrunix.UUCP (Alexander Hinds) (05/05/88)
I'm writing a program and I need to use alerts. However, the Intuition manual isn't too clear on the String structure definition. What I really don't understand is if I want more than one string to appear in my alert, do I link the various structures together via the last field? (I can't remember what's it suppossed to be called right now.) The Intuition manual says that this field is a byte long, but that's not long enough for a pointer. Are they assuming that the byte is really an integer and is assumed to be 32bits long? Any help would be appreciated. I thank you in advance. Alexander Hinds ahinds@hvrford
schein@cbmvax.UUCP (Dan Schein CATS) (05/06/88)
In article <421@hvrunix.UUCP> ahinds@hvrunix.UUCP (Alexander Hinds) writes: > > I'm writing a program and I need to use alerts. However, the >Intuition manual isn't too clear on the String structure definition. >What I really don't understand is if I want more than one string to >appear in my alert, do I link the various structures together via the >last field? (I can't remember what's it suppossed to be called right >now.) The Intuition manual says that this field is a byte long, but that's >not long enough for a pointer. Are they assuming that the byte is really >an integer and is assumed to be 32bits long? Any help would be appreciated. >I thank you in advance. > >Alexander Hinds Heres an OLD example I threw together, its not pretty - but it works :-) /* Create a RECOVERY_ALERT */ /* 09-29-87 Dan Schein */ #include <exec/types.h> extern APTR OpenLibrary(); extern VOID CloseLibrary(); APTR IntuitionBase; char String[] = {0x00,0x18,0x18,'y','o','u',0,1, 0x00,0x40,0x20,'b','u','m',0,0}; void main(); void main() { int i; int Height = 50; long AlertNumber = 00010000; IntuitionBase = OpenLibrary("intuition.library",33); /* open library and check for a specific version of OS */ /* 0 = Any version 30 = 1.0 or higher 31 = 1.1 NTSC or higher 32 = 1.1 PAL or higher 33 = 1.2 or higher */ if (IntuitionBase != 0) /* if open succeeded */ { i = DisplayAlert(AlertNumber,String,Height); /* open alert window & check which button is pressed */ if (i != 0) /* user pressed left button */ { printf("You pressed the left button!\n"); } else /* user pressed right button */ { printf("You pressed the right button!\n"); } } else { printf("Update to V1.2!\n"); /* OS version failure message */ } CloseLibrary(IntuitionBase); /* exit gracefully */ } -- Dan "Sneakers" Schein uucp: {ihnp4|allegra|burdvax|rutgers}!cbmvax!schein Commodore AMIGA ARPANET: cbmvax!schein@uunet.uu.net 1200 Wilson Drive Bix: dschein Plink: Dan*CATS West Chester PA 19380 phone: (215) 431-9100 ext. 9542 +----------------------------------------------------------------------------+ Call BERKS AMIGA BBS - 24 Hrs - 3/12/2400 Baud - 40Meg - 215/678-7691 +----------------------------------------------------------------------------+ I help Commodore by supporting the AMIGA. Commodore supports me by allowing me to form my own suggestions and comments.
msl5864@ritcv.UUCP (Michael S. Leibow) (05/07/88)
In article <421@hvrunix.UUCP> ahinds@hvrunix.UUCP (Alexander Hinds) writes: > > I'm writing a program and I need to use alerts. However, the >Intuition manual isn't too clear on the String structure definition. >What I really don't understand is if I want more than one string to >appear in my alert, do I link the various structures together via the >last field? (I can't remember what's it suppossed to be called right >now.) The Intuition manual says that this field is a byte long, but that's >not long enough for a pointer. Are they assuming that the byte is really >an integer and is assumed to be 32bits long? Any help would be appreciated. >I thank you in advance. > >Alexander Hinds >ahinds@hvrford The DisplayAlert() call accepts three parameters. The first is an alert number which describes whether the alert will reboot the machine or not. If you want to reboot the machine use DEADEND_ALERT. If you want to recover after the alert (doesn't happen all of the time, only 99.9%) use RECOVERY_ALERT. The second paramater is the string: byte 1 is most significant byte of 16 bit integer. byte 2 is least significant byte of 16 bit integer. These bytes are a x coordinate for text. (0 - 640) byte 3 is a y coordinate. (0 - 200 + baseline) bytes 4 - n ascii text to be displayed. Will not wrap at the end but will be truncated. byte n+1 is a zero. byte n+2 is a zero if you only have one line of text. byte n+2 is a one if you have more text. If you use a one in this spot, you must have another text record that looks exactly like what I just displayed. example: An alert that looks like the following: +---------------------------------------------+ | RECOVERY ALERT -- BLAH BLAH BLAH | | SOME OTHER STUPID PIECE OF TEXT | +---------------------------------------------+ char *cp, text[40000000000000]; /* not this big, really */ cp = text; *cp++ = '\0'; /* xpos = 10 */ *cp++ = '\10'; *cp++ = '\10'; /* ypos = 10 */ strcpy(cp, "RECOVERY ALERT -- BLAH BLAH BLAH"); for (;*cp;cp++); *cp++ = '\1'; /* continuation character (nonzero) */ *cp++ = '\0'; /* xpos = 10 */ *cp++ = '\10'; *cp++ = '\20'; /* ypos = 20 */ strcpy(cp, "SOME OTHER STUPID PIECE OF TEXT"); /* end of alert text */ DisplayAlert(RECOVERY_ALERT, text, 30); -- Michael S. Leibow UUCP: {allegra,seismo}!rochester!ritcv!msl5864 CSNET: msl5864%rit@csnet-relay.ARPA
bryce@cbmvax.UUCP (Bryce Nesbitt) (05/07/88)
In article <421@hvrunix.UUCP> ahinds@hvrunix.UUCP (Alexander Hinds) writes: > > I'm writing a program and I need to use alerts. Why? They are so obnoxious. >...if I want more than one string to >appear in my alert, do I link the various structures together via the >last field?... >...The Intuition manual says that this field is a byte long, but that's >not long enough for a pointer.... The string that DisplayAlert() takes is just one big string: dc.b xx , xx , yy , 'this is the string' , 0 , 255 dc.b xx , xx , yy , 'this is the other string' , 0 , 0 So, x and y position. The null terminated string. The continuation byte of 255 on the first line indicates more data to come. The 0 after the second lines indicates the end. There is no need for a pointer, since the next string is right there.