home *** CD-ROM | disk | FTP | other *** search
- Path: sn.no!usenet
- From: elvemo@sn.no (Rune Elvemo)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Problem with BOOPSI
- Date: 27 Mar 1996 17:13:18 GMT
- Organization: SN Internett
- Message-ID: <6593.6660T1030T543@sn.no>
- NNTP-Posting-Host: sinsen.sn.no
- Priority: Urgent
- X-Newsreader: THOR 2.22 (Amiga;TCP/IP) *UNREGISTERED*
-
- I have a problem with a BOOPSI system. I have set up all the gagdets to
- communicate using ICA_MAP and a Class under ModelClass. When I press one of
- the buttons I *always* get a Guru.
-
- Here goes the source (I have only one gadget in this one, but later I will
- include to buttons (up and down buttons for the prop).
-
- As you can see from the source bellow, I use the RKMModel, which can be found
- in RKRM:Libraries. (I *had* one that I made by myself, but I think there was
- something wrong with it :-( ).
-
- You migh want to know, that I removed the line in the dispather routine in
- RKMModel, saying : "geta4()". I don't know this is what's causing the Gurus.
-
- ---------------------- !Clip Here! ------------------------
-
- #include <exec/types.h>
- #include <intuition/intuition.h>
- #include <intuition/screens.h>
- #include <intuition/classes.h>
- #include <intuition/classusr.h>
- #include <intuition/gadgetclass.h>
- #include <intuition/imageclass.h>
- #include <intuition/cghooks.h>
- #include <intuition/icclass.h>
- #include <utility/tagitem.h>
- #include <utility/hooks.h>
-
- #include <clib/intuition_protos.h>
- #include <clib/exec_protos.h>
- #include <clib/utility_protos.h>
- #include <clib/alib_protos.h>
- #include <clib/alib_stdio_protos.h>
-
- #include "dsamples:RKMModel.c"
-
- struct Library *IntuitionBase;
- struct Library *UtilityBase;
-
- Class *EdModCl;
-
- Object *ed_model, *curr2prop;
-
- struct Gadget *prop;
-
- #define PROPGADID 1L
-
- struct TagItem prop2ed[] =
- {
- {PGA_Top, RKMMOD_CurrVal},
- {TAG_END,}
- };
-
- struct TagItem ed2prop[] =
- {
- {RKMMOD_CurrVal, PGA_Top},
- {TAG_END,}
- };
-
- struct Screen *wb;
- struct Window *win;
-
- /* prototype */
- BOOL MakeEnv(void);
- void handleIDCMP(void);
-
- main()
- {
- BOOL Continue;
- ULONG *test;
-
- if (IntuitionBase = OpenLibrary("intuition.library", 37))
- {
- if (UtilityBase = OpenLibrary("utility.library", 37))
- {
- if (EdModCl = initRKMModClass())
- {
- if (wb = LockPubScreen("Workbench"))
- {
- if (Continue = MakeEnv())
- {
- DoMethod(ed_model, OM_ADDMEMBER,
- curr2prop);
-
- if (win = OpenWindowTags(NULL,
- WA_Top, wb->BarHeight,
- WA_Left, 0,
- WA_Width, wb->Width,
- WA_Height,
- (wb->Height - wb->BarHeight),
- WA_Title, "Test
- of the
- ED_Mod",
- WA_PubScreen, wb,
- WA_MinWidth, 20,
- WA_MinHeight, 10,
- WA_Flags, WFLG_SIZEGADGET |
- WFLG_DRAGBAR |
- WFLG_DEPTHGADGET |
- WFLG_CLOSEGADGET,
- WA_IDCMP, IDCMP_CLOSEWINDOW,
- WA_Gadgets, prop,
- TAG_END))
- {
-
- handleIDCMP();
-
- DisposeObject(ed_model);
- DisposeObject(prop);
-
- CloseWindow(win);
- }
- }
- UnlockPubScreen(NULL, wb);
- }
- freeRKMModClass(EdModCl);
- }
- CloseLibrary(UtilityBase);
- }
- CloseLibrary(IntuitionBase);
- }
- }
-
- /* ::: Make the evniroment ::: */
- BOOL MakeEnv(void)
- {
- BOOL AllDone = FALSE;
- ULONG WinTopBor = (wb->WBorTop) + (wb->Font->ta_YSize) + 1; /* Height of the
- Top Border of the window */
-
- int left = 3;
-
- if (ed_model = NewObject(EdModCl, NULL,
- RKMMOD_Limit, 10,
- RKMMOD_CurrVal, 0,
- TAG_END))
- {
- left--;
-
- if(prop = NewObject (NULL, "propgclass",
- GA_ID, PROPGADID,
- GA_Top, (WinTopBor + 1),
- GA_RelRight, -13,
- GA_Width, 10,
- GA_RelHeight, -(WinTopBor +12),
-
- ICA_MAP, prop2ed,
- ICA_TARGET, ed_model,
-
- PGA_Freedom, FREEVERT,
- PGA_NewLook, TRUE,
- PGA_Borderless, TRUE,
-
- PGA_Top, 0,
- PGA_Total, 100,
- PGA_Visible, 10,
-
- TAG_END))
- {
- left--;
-
- if(curr2prop = NewObject(NULL, "icclass",
- ICA_MAP, ed2prop,
- ICA_TARGET, ed_model,
- TAG_END))
- {
- left--;
-
- }
- }
- }
- printf("Left = %d\n", left);
-
- switch(left)
- {
- case 2:
- DisposeObject(ed_model);
- printf("here! 1\n");
-
- break;
-
- case 1:
- DisposeObject(ed_model);
- DisposeObject(prop);
- printf("here! 2\n");
-
- break;
-
- case 0:
- AllDone = TRUE;
- printf("here! 3\n");
-
- break;
- }
- }
-
- /* Take care of *one* of the signals arriving at our port */
- void handleIDCMP(void)
- {
- struct IntuiMessage *msg;
- BOOL done = FALSE;
- ULONG Class;
-
- while (!done)
- {
- Wait(1L << win->UserPort->mp_SigBit);
-
- while (msg = GetMsg(win->UserPort))
- {
- Class = msg->Class;
-
- ReplyMsg(msg);
-
- switch(Class)
- {
- case IDCMP_CLOSEWINDOW:
- done = TRUE;
- break;
- }
- }
- }
- }
-
- ---------------------- !Clip Here! ------------------------
-
- Rune Elvemo
- elvemo@sn.no
- -It's cool to be clear :-)
-
-