home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 3871 < prev    next >
Encoding:
Text File  |  1996-08-05  |  3.0 KB  |  97 lines

  1. Path: tempus.ii.uni.wroc.pl!chyras
  2. From: chyras@ii.uni.wroc.pl (Radoslaw Chyra)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: MUI programming problem ...
  5. Date: 19 Feb 1996 16:28:08 GMT
  6. Organization: Technical Univeristy of Wroclaw
  7. Message-ID: <4ga8eo$bcu@sun1000.pwr.wroc.pl>
  8. NNTP-Posting-Host: tempus.ii.uni.wroc.pl
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. I'm playing around with MUI 3.1(2) and I wrote a little proggy, which was
  12. supposed to open window with one button in it. But, when I compiled it
  13. (using SAS/C 5.61), it began to guru every time. Below i've included
  14. main parts of my source. I've traced this proggy, and figured that 
  15. MainWindowDispatcher is first called with OM_NEW, so MainWindow_New is called
  16. and it creates object. Then Dispatcher is called with OM_ADDTAIL, and as
  17. everything is passed to super class, via DoSuperMethodA. And here is the point
  18. when everything falls. It seems that object (obj) passed to my dispatcher
  19. has uninitialized IClass pointer, and when DoSuperMethod wants to call paret
  20. class dipatcher, it simply jumps at 0 !   
  21.  
  22. Any solutions ? Thanks in advance ...
  23.  
  24. Radoslaw Chyra
  25.  
  26. Here my code goes ...
  27. Of course it is more complex, I threw away all unnecessary checks, etc.
  28.  
  29. ------------------------------------------
  30.  
  31. Object * IQApp,
  32.        * IQWin;
  33.  
  34. struct MUI_CustomClass * MainWindowClass;
  35.  
  36. VOID main (VOID)
  37. {
  38.   if (! (MUIMasterBase = OpenLibrary (MUIMASTER_NAME, MUIMASTER_VMIN)))
  39.     Cleanup ("Cannot open muimaster.library");
  40.  
  41.   MainWindowClass = MUI_CreateCustomClass (NULL, MUIC_Window,
  42.                     NULL, sizeof (struct MainWindow_Data),
  43.                     MainWindowDispatcher);
  44.   IQWin = NewObject (MainWindowClass->mcc_Class, NULL, TAG_DONE),
  45.   IQApp = ApplicationObject,
  46.             MUIA_Application_Title,       "ModMIQ",
  47.             MUIA_Application_Version,     "$VER: ModMIQ v0.99",
  48.             MUIA_Application_Copyright,   "aaa",
  49.             MUIA_Application_Author,      "aaa",
  50.             MUIA_Application_Description, "aaa",
  51.             MUIA_Application_Base,        "MODMIQ",
  52.             MUIA_Application_Window,      IQWin,
  53.             End;
  54.  
  55. ...
  56.  
  57. }
  58.  
  59. ULONG MainWindow_New (struct IClass * class, Object * obj, struct opSet * msg)
  60. {
  61.   obj = (Object *) DoSuperNew (class, obj,
  62.               MUIA_Window_Title,       "bbb",
  63.               MUIA_Window_ID,          MakeID ('M','M','I','Q'),
  64.               MUIA_Window_ScreenTitle, "bbb",
  65.               WindowContents, VGroup,
  66.                 Child, SimpleButton ("BUBU"),
  67.               End,
  68.             TAG_MORE, msg->ops_AttrList);
  69.   if (obj)
  70.     {
  71.       return ((ULONG) obj);
  72.     }
  73.   return (NULL);
  74. }
  75.  
  76. __saveds __asm ULONG MainWindowDispatcher (register __a0 struct IClass * class,
  77.                                            register __a2 Object * obj,
  78.                                            register __a1 Msg msg)
  79. {
  80.   switch (msg->MethodID)
  81.     {
  82.       case OM_NEW:
  83.         {
  84.           return (MainWindow_New (class, obj, (APTR) msg));
  85.         }
  86.     }
  87.   return (DoSuperMethodA (class, obj, msg));
  88. }
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.