home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / pascal / 8596 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  3.5 KB

  1. Path: sparky!uunet!munnari.oz.au!sgiblab!sdd.hp.com!usc!rpi!ghost.dsi.unimi.it!univ-lyon1.fr!pc110-02.insa-lyon.fr!ppollet
  2. From: ppollet@cismibm.univ-lyon1.fr (Patrick POLLET)
  3. Newsgroups: comp.lang.pascal
  4. Subject: Re: Need Help with Resource and Init
  5. Date: Wed, 27 Jan 1993 09:19:08 GMT
  6. Organization: INSA  CENTRE INFORMATIQUE DU 1er CYCLE
  7. Lines: 83
  8. Message-ID: <ppollet.185.728126348@cismibm.univ-lyon1.fr>
  9. References: <1993Jan26.223719.16694@a.cs.okstate.edu>
  10. NNTP-Posting-Host: pc110-02.insa-lyon.fr
  11.  
  12. In article <1993Jan26.223719.16694@a.cs.okstate.edu> greaham@a.cs.okstate.edu (GREAHAM DARIN DONA) writes:
  13. >From: greaham@a.cs.okstate.edu (GREAHAM DARIN DONA)
  14. >Subject: Need Help with Resource and Init
  15. >Date: Tue, 26 Jan 93 22:37:19 GMT
  16.  
  17.  
  18.  
  19. >   I am attempting to place a derivation of a dialog box's Init constructor
  20. >into a resource file.  The problem that arises is that the HandleEvent for
  21. >the dialogbox no longer works.  I seem to be doing something dreadfully
  22. >wrong but can't quite put my finger on it.  Simple type declaration:
  23.  
  24. >   Type 
  25. >     PBox = ^TBox;
  26. >     TBox = Object(TDialog)
  27. >        constructor Init;
  28. >        destructor ...
  29. >        procedure HandleEvent...
  30. >     end;
  31.  
  32.  
  33. >   Now that the Init is all in a resource file, using 
  34. >          Box := New(PBox,Init)
  35.  
  36. >   won't work, of course.  But
  37. >          Box := PBox(ResFile.Get('DialogBox'));
  38.  
  39. >   will but the HandleEvent doesn't respond.  I'm not for sure what to do
  40. >past this point.  I've tried numerous things but nothing works.
  41.  
  42. >BTW: The dialog box that is in the resource file is NOT inherited from 
  43. >     PBox, should it?? 
  44.  
  45.  
  46.  
  47. >   Thanks for any help.
  48.  
  49. >   Darin...
  50.  
  51.     If you place a DESCENDANT of tDialog in a ressource, as it seems you
  52. try to do it, YOU MUST register that descendant using a tStreamRec record
  53. with an object ID different of the object ID of tDialog (10 I think).
  54.     
  55.  Something like:
  56.    
  57.    Const RMyBox:tStreamRec=
  58.           ObjType: 200;         <=== whatever unique number > 100 
  59.           Vtmlink:ofs(TypeOf(TMyBox));
  60.           Load:@tMyBox.load;     <=== even if you do not overloaded them
  61.           Store:@tMyBox.Store    <===   "      "      "      "        "
  62.          end; 
  63.  
  64.    And in your program you must register that new object by
  65.      RegisterType(rMyBox) .
  66.        This must be done :
  67.           -in the program that wrote that object to a stream
  68.           -in the program that reads it back ( likely you real
  69.               application)   
  70.   
  71.    The point of this is to WRITE at the beginning of the image of the 
  72. box in the stream the ID 200 (for your box) and not the ID 10 (for 
  73. tDialog)
  74.  
  75.     When you application READS back the box from the stream , it should see 
  76. ID=200 and uses that value to search the tStreamRecs list and find a match 
  77. with your Rbox tstreamrec . That will determine what VTM to use for your 
  78. box and especially the REAL ADDRESS of the overloaded HandleEvent() method.
  79. If you did not do it, the ID=10 will be found and the standard VTM of
  80. tDialog will be used. And all the virtual methods will be resolved to
  81. those of tDialog and not to yours ....
  82.  
  83. Hope I have been clear ( not sure ....)
  84. ppollet@cismibm.univ-lyon1.fr (Patrick POLLET)
  85. --------------------------------------------------------
  86. Dr Patrick L.Pollet
  87. Institut National des Sciences Appliquees
  88. Centre Informatique du 1er Cycle  Bat 110
  89. 20 Avenue A.Einstein
  90. 69621 Villeurbanne Cedex France
  91. --------------------------------------------------------
  92. Phone: 72 43 83 80 -   la premiere erreur c'est
  93. Fax  : 72 43 85 33 -   de se lever le matin  ... GASTON
  94. -------------------------------------------------------
  95.