home *** CD-ROM | disk | FTP | other *** search
- Path: tempus.ii.uni.wroc.pl!chyras
- From: chyras@ii.uni.wroc.pl (Radoslaw Chyra)
- Newsgroups: comp.sys.amiga.programmer
- Subject: MUI programming problem ...
- Date: 19 Feb 1996 16:28:08 GMT
- Organization: Technical Univeristy of Wroclaw
- Message-ID: <4ga8eo$bcu@sun1000.pwr.wroc.pl>
- NNTP-Posting-Host: tempus.ii.uni.wroc.pl
- X-Newsreader: TIN [version 1.2 PL2]
-
- I'm playing around with MUI 3.1(2) and I wrote a little proggy, which was
- supposed to open window with one button in it. But, when I compiled it
- (using SAS/C 5.61), it began to guru every time. Below i've included
- main parts of my source. I've traced this proggy, and figured that
- MainWindowDispatcher is first called with OM_NEW, so MainWindow_New is called
- and it creates object. Then Dispatcher is called with OM_ADDTAIL, and as
- everything is passed to super class, via DoSuperMethodA. And here is the point
- when everything falls. It seems that object (obj) passed to my dispatcher
- has uninitialized IClass pointer, and when DoSuperMethod wants to call paret
- class dipatcher, it simply jumps at 0 !
-
- Any solutions ? Thanks in advance ...
-
- Radoslaw Chyra
-
- Here my code goes ...
- Of course it is more complex, I threw away all unnecessary checks, etc.
-
- ------------------------------------------
-
- Object * IQApp,
- * IQWin;
-
- struct MUI_CustomClass * MainWindowClass;
-
- VOID main (VOID)
- {
- if (! (MUIMasterBase = OpenLibrary (MUIMASTER_NAME, MUIMASTER_VMIN)))
- Cleanup ("Cannot open muimaster.library");
-
- MainWindowClass = MUI_CreateCustomClass (NULL, MUIC_Window,
- NULL, sizeof (struct MainWindow_Data),
- MainWindowDispatcher);
- IQWin = NewObject (MainWindowClass->mcc_Class, NULL, TAG_DONE),
- IQApp = ApplicationObject,
- MUIA_Application_Title, "ModMIQ",
- MUIA_Application_Version, "$VER: ModMIQ v0.99",
- MUIA_Application_Copyright, "aaa",
- MUIA_Application_Author, "aaa",
- MUIA_Application_Description, "aaa",
- MUIA_Application_Base, "MODMIQ",
- MUIA_Application_Window, IQWin,
- End;
-
- ...
-
- }
-
- ULONG MainWindow_New (struct IClass * class, Object * obj, struct opSet * msg)
- {
- obj = (Object *) DoSuperNew (class, obj,
- MUIA_Window_Title, "bbb",
- MUIA_Window_ID, MakeID ('M','M','I','Q'),
- MUIA_Window_ScreenTitle, "bbb",
- WindowContents, VGroup,
- Child, SimpleButton ("BUBU"),
- End,
- TAG_MORE, msg->ops_AttrList);
- if (obj)
- {
- return ((ULONG) obj);
- }
- return (NULL);
- }
-
- __saveds __asm ULONG MainWindowDispatcher (register __a0 struct IClass * class,
- register __a2 Object * obj,
- register __a1 Msg msg)
- {
- switch (msg->MethodID)
- {
- case OM_NEW:
- {
- return (MainWindow_New (class, obj, (APTR) msg));
- }
- }
- return (DoSuperMethodA (class, obj, msg));
- }
-
-
-
-
-
-
-
-
-