• toolbox alert with resources

    From Tom Thumb@21:1/5 to All on Fri Nov 25 10:27:35 2022
    "Toolbox Programming in C", Mike Westerfield, pg79 states:

    "size This field is generally a single character controlling the size of the alert window.
    The character is a numeric digit, from 0 to 9. All but the first of these digits corresponds to a specific size window, but the 0 character is the first byte of a nine byte field. The other bytes define the size of the window by listing the edges as two-
    byte integers, in this format:..."

    I get rects and V1,H1,V2,H2 coordinates But not how to specify them in a string.

    My question: If I enter a 0 as the first character of the alert string how do I then enter the four two-byte integers in the nine byte field? I've tried several things and I'm thinking it's simple but I'm not getting it. I know there are calls I can
    make providing templates but I'm trying to get this resource example working specifying a custom alert size.


    /*- About Box --------------------------------------------------*/

    resource rAlertString (1) {
    "43/"
    "Frame 1.0\n"
    "by Mike Westerfield\n"
    "\n"
    "Contains libraries from ORCA C,\n"
    "Copyright 1991, Byte Works Inc."
    "/^#0\$00";
    };

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tom Thumb@21:1/5 to Kelvin Sherlock on Sat Nov 26 20:10:26 2022
    Thank you much.
    I belatedly found what should have been enough to clue me in in chapter 10 of the ORCA/C manual but I still would have had trouble with it without your help.

    On Saturday, November 26, 2022 at 12:02:55 AM UTC-5, Kelvin Sherlock wrote:
    The rectangle needs to be broken up into 8 bytes (keeping in mind the
    words are little endian). Assuming a rectangle of (20, 20, 180, 620),
    convert it to hexadecimal (0x0014, 0x0014, 0x00b4, 0x026c), convert it
    to bytes (0x14, 0x00, 0x14, 0x00, 0xb4, 0x00, 0x6c, 0x02), and embed it ("0\0x14\0x00\0x14\0x00\0xb4\0x00\0x6c\0x02" ... )
    On 2022-11-25 18:27:35 +0000, Tom Thumb said:


    "Toolbox Programming in C", Mike Westerfield, pg79 states:

    "size This field is generally a single character controlling the size
    of the alert window.
    The character is a numeric digit, from 0 to 9. All but the first of
    these digits corresponds to a specific size window, but the 0 character
    is the first byte of a nine byte field. The other bytes define the size
    of the window by listing the edges as two-byte integers, in this format:..."

    I get rects and V1,H1,V2,H2 coordinates But not how to specify them in
    a string.

    My question: If I enter a 0 as the first character of the alert string
    how do I then enter the four two-byte integers in the nine byte field?
    I've tried several things and I'm thinking it's simple but I'm not
    getting it. I know there are calls I can make providing templates but
    I'm trying to get this resource example working specifying a custom
    alert size.


    /*- About Box --------------------------------------------------*/

    resource rAlertString (1) {
    "43/"
    "Frame 1.0\n"
    "by Mike Westerfield\n"
    "\n"
    "Contains libraries from ORCA C,\n"
    "Copyright 1991, Byte Works Inc."
    "/^#0\$00";
    };

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kelvin Sherlock@21:1/5 to All on Sun Nov 27 18:10:43 2022
    Another option would be to replace the rAlertString rez definition:

    (don't update types.rez, just put this in your rez file before using it.
    There will be a warning about the redefinition but compile rez=(-rd) will disable it).

    type rAlertString {

    switch {
    case sizeCustom:
    key byte = 0x30;
    rect;
    case size30: key byte = 0x31;
    case size60: key byte = 0x32;
    case size110: key byte = 0x33;
    case size175: key byte = 0x34;
    case size110: key byte = 0x35;
    case siz140: key byte = 0x36;
    case size200: key byte = 0x37;
    case size250: key byte = 0x38;
    case size300: key byte = 0x39;
    };

    switch {
    case iconNone: key byte = 0x30;
    case iconCustom:
    key byte = 0x31;
    longint;
    int;
    int;
    case iconStop: key byte = 0x32;
    case iconNote: key byte = 0x33;
    case iconCaution: key byte = 0x34;
    case iconDisk: key byte = 0x35;
    case iconDiskSwap: key byte = 0x36;
    };

    string;
    string = $"00";
    };

    Example usage:

    resource rAlertString (3) {

    sizeCustom { { 12, 34, 56, 78 }},
    iconNone {} ,
    "/abc/#0"
    };

    resource rAlertString (4) {
    size30 {},
    iconCustom { 12, 20, 40 } ,
    "/abc/#0"
    };

    Note the empty {} are required even if it's a standard size or icon. The trailing $00 terminator is automatically provided.

    -------
    ProLine: kelvin@pro-kegs

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)