Path: utzoo!mnetor!uunet!husc6!m2c!applix!scott From: scott@applix.UUCP (Scott Evernden) Newsgroups: comp.sys.amiga Subject: PropGadgets Message-ID: <654@applix.UUCP> Date: 19 Feb 88 06:47:12 GMT Sender: news@applix.UUCP Reply-To: scott@applix.UUCP (Scott Evernden) Organization: APPLiX Inc., Westboro MA Lines: 95 The following code illustrates a problem with PropGadgets which I keep running into. This bug was introduced in version 1.2 of the Amiga OS. Simply stated, a PropGadget with a LeftEdge/TopEdge of 0 (i.e., butted against the window border) doesn't work properly. Make LeftEdge 1 or -1 and everything works fine. This annoyance makes it difficult to place sliders squarely along the window edges. This program expects 1 argument- the value of a horizontal PropGadget's LeftEdge. As you move the slider, the program prints the Prop's Pot value. Note that when you run with an argument of 0, and move the slider away, and then back to the left side, it will not read 0 ever. Instead, some other random and nonsense value is returned. > prop 1 both of these ... > prop -1 ... work just fine > prop 0 demonstrates the never-0 gadget -scott /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* prop.c */ #include #include #define HTOP -11 #define HHYT 12 #define HBODY 0x1FFF struct Image hi; /* horizontal gadget */ struct PropInfo hpi = { AUTOKNOB | FREEHORIZ, 0, 0, HBODY, MAXBODY }; struct Gadget hg = { NULL, 0, HTOP, 0, HHYT, GADGHNONE | GRELBOTTOM | GRELWIDTH, GADGIMMEDIATE | RELVERIFY, PROPGADGET, (APTR) &hi, NULL, NULL, 0, (APTR) &hpi, 99 }; struct NewWindow nw = { 20, 10, 320, 40, 0, 1, GADGETUP | CLOSEWINDOW, NOCAREREFRESH | WINDOWDRAG | WINDOWCLOSE | ACTIVATE, &hg, NULL, NULL, NULL, NULL, 0, 0, 0, 0, WBENCHSCREEN }; struct IntuitionBase *IntuitionBase, *OpenLibrary(); struct Window *w, *OpenWindow(); struct IntuiMessage *GetMsg(); /***************************************/ main(argc, argv) char *argv[]; { extern int Enable_Abort; struct IntuiMessage *msg; ULONG class; int quit; quit = Enable_Abort = 0; /* install LeftEdge */ if (1 < argc) { hg.LeftEdge = atoi(argv[1]); hg.Width = -hg.LeftEdge; } /* opens; (skipping checks) */ IntuitionBase = OpenLibrary("intuition.library", 0L); w = OpenWindow(&nw); while (!quit) { Wait(1L << w->UserPort->mp_SigBit); while (msg = GetMsg(w->UserPort)) { class = msg->Class; ReplyMsg(msg); switch (class) { /* read current pot value */ case GADGETUP: printf("horizProp: val 0x%x\n", hpi.HorizPot); break; case CLOSEWINDOW: quit = 1; break; } } } /* bye */ CloseWindow(w); CloseLibrary(IntuitionBase); }