home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / os / mswindo / programm / misc / 1828 < prev    next >
Encoding:
Text File  |  1992-09-14  |  1.9 KB  |  53 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!spool.mu.edu!sdd.hp.com!uakari.primate.wisc.edu!ames!pacbell.com!tandem!av8r.cpd.Tandem.com!stu
  3. From: stu@av8r.cpd.Tandem.com (Stuart Phillips)
  4. Subject: OWL: Adopting other child windows ?
  5. Message-ID: <1992Sep14.165854.18660@tandem.com>
  6. Sender: news@tandem.com
  7. Nntp-Posting-Host: av8r.cpd.tandem.com
  8. Reply-To: stu@Tandem.COM
  9. Organization: Tandem Computers, Cupertino - USA
  10. Date: Mon, 14 Sep 1992 16:58:54 GMT
  11. Lines: 40
  12.  
  13. I've developed a class using Borland OWL that controls a window with two
  14. child windows on its surface much like that used by the File Manager.  I
  15. would like to make this general enough that I can use it in multiple
  16. applications and so have made the class itself ignorant of the behavior
  17. of each of its child windows.
  18.  
  19. I'd like to create the child windows and pass them as parameters to the
  20. constructor of my controlling class (TDoubleWindow) - something like this:
  21.  
  22.     PTWindow left = new TWindow(this,"");
  23.     PTWindow right = new TWindow(this,"");
  24.  
  25.     PTDoubleWindow Dbl = new TDoubleWindow(this,"Title",left,right);
  26.  
  27. The problem with this approach is that the owning window of the children
  28. isnt Dbl since the left and right child windows are owned by the common
  29. parent of all three.
  30.  
  31. There is a method in TWindowObject called SetParent() that looks tailor
  32. made to do the job of having Dbl adopt left and right as its own children.
  33. I tried inserting calls as follows in the constructor for TDoubleWindow:
  34.  
  35.     left->SetParent(this);
  36.     right->SetParent(this);
  37.  
  38. ....but when I subsequently call MakeWindow to actually create the interface
  39. objects, the MakeWindow fails with error -5 (illegal window handle).
  40.  
  41. How does an object adopt other objects children ?
  42.  
  43.  
  44.  
  45. I have one work around that ducks the entire issue and that's defining
  46. TDoubleWindow as a template class; however this makes it a pain to derive
  47. objects from TDoubleWindow so I'm still in need of a solution.
  48.  
  49. Can anyone help ?
  50.  
  51. Thanks
  52. Stu
  53.