Path: utzoo!attcan!uunet!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!ub!rutgers!cunixf.cc.columbia.edu!cunixb.cc.columbia.edu!es1 From: es1@cunixb.cc.columbia.edu (Ethan Solomita) Newsgroups: comp.sys.amiga Subject: GadTools HELP! Message-ID: <1990Oct4.004459.7005@cunixf.cc.columbia.edu> Date: 4 Oct 90 00:44:59 GMT Sender: news@cunixf.cc.columbia.edu (The Daily News) Organization: Columbia University Lines: 151 I am trying to write a program to try and figure out the intracacies of programming the Amiga. I am using 2.0 on an A3000 and am trying to make a reasonably simple program. It opens a window and places a slider gadget in it which can range from 0 to 100. When it is slid to 100, the gadget is disabled. When it is slid to 0, the program quits. You can also click the close gadget to quit. Well, it ain't coming close to that and I am hoping that someone out there in netville (Peter Cherna??? 8) could help me find the problems. When I run the compiled version, the mouse point hesitates for a few secs, control is returned to the CLI with no exit code returned. The window opens, but is empty. The title appears correctly, but when the window is moved it changes either to garbage or blank. The slider gadget doesn't appear, but when I try to find it and drag it it appears and slides. The program no longer exists/responds, the close gadget and the slider gadget create no effects. Also the text from the gadget never appears. Here is the Lattice C program. I know it isn't short and isn't commented. I appreciate the favor. Thanks. #include #include #include #include int IntuitionOpen = 0; int GadToolsOpen = 0; struct IntuitionBase *IntuitionBase = NULL; struct GadToolsBase *GadToolsBase = NULL; struct window *window1 = NULL; struct Screen *WBScreen = NULL; APTR vi = NULL; struct Gadget *currgad; struct Gadget *gadlist = NULL; void CleanExit(returnvalue) int returnvalue; { if (IntuitionBase) CloseLibrary ((struct Library *)IntuitionBase); if (GadToolsBase) CloseLibrary ((struct Library *)GadToolsBase); if (window1) CloseWindow (window1); if (WBScreen) UnlockPubScreen (NULL, WBScreen); if (vi) FreeVisualInfo(vi); if (gadlist) FreeGadgets(gadlist); exit (returnvalue); } struct TagItem WindowTags[] = { {WA_Title, (ULONG)"MyWindow"}, {WA_Flags, (ULONG)SMART_REFRESH|WINDOWCLOSE|WINDOWDEPTH|WINDOWDRAG}, {WA_Height, 150L}, {WA_Width, 600L}, {TAG_DONE, } }; struct NewGadget ng = { 150, 60, 280, 60, "MyGadgetText", NULL, 1, NULL, &vi, NULL }; struct TagItem GadgetTags[] = { {GTSL_Min, 0L}, {GTSL_Max, 100L}, {GTSL_Level, 50L}, {GTSL_LevelFormat, (ULONG)"(Level: %l)"}, {GTSL_MaxLevelLen, 12L}, {GTSL_LevelPlace, (ULONG)PLACETEXT_RIGHT}, {TAG_DONE, } }; void handleIDCMP(struct Window *win) { struct IntuiMessage *message = NULL; APTR object; ULONG class; WORD code; while (message = (struct IntuiMessage *)GT_GetIMsg(win->UserPort)) { object = message->IAddress; class = message->Class; code = (WORD)message->Code; GT_ReplyIMsg(message); switch(class) { case CLOSEWINDOW: CleanExit(0); case MOUSEMOVE: if (code = 100) GT_SetGadgetAttrs(currgad, win, NULL, GA_DISABLED, TRUE, TAG_DONE); if (code = 0) CleanExit(0); break; } } } void main(int argc, char *argv[]) { IntuitionBase = (struct IntuitionBase *) OpenLibrary ("intuition.library", 36); if (IntuitionBase == NULL) CleanExit(30); GadToolsBase = (struct GadToolsBase *) OpenLibrary ("gadtools.library", 36); if (GadToolsBase == NULL) CleanExit(30); WBScreen = LockPubScreen(NULL); if (WBScreen == NULL) { printf ("lockpubscreen error"); CleanExit(30); } ng.ng_TextAttr = WBScreen->Font; vi = GetVisualInfo (WBScreen); if (vi = NULL) { printf ("getvisualinfo error"); CleanExit(30); } currgad = CreateContext (&gadlist); currgad = CreateGadgetA(SLIDER_KIND, currgad, &ng, GadgetTags); window1 = OpenWindowTagList (NULL, WindowTags); if (!currgad) { printf ("currgad is false"); CleanExit(30); } AddGList (window1, gadlist, -1, -1, NULL); GT_RefreshWindow (window1, NULL); handleIDCMP (window1); } -- Ethan Ethan Solomita: es1@cunixb.cc.columbia.edu *Iraq += *Kuwait; NumCountries--; and by popular demand... free(Kuwait);