PDA

Click to See Complete Forum and Search --> : More Doc/View issues


noble
Jun 20th, 2002, 06:47 PM
im using some 3rd party code (BCG to be exact). I'm forced to
derive an object from the TreeCtrl in order to create the
control which i place inside one of the control bars that BCG
offers. How would i access the Document from this ctrl?

Any help or better advice for this is greatly appreciated.

CornedBee
Jul 3rd, 2002, 03:23 AM
You have two options:
a) AfxGetMainWnd()->GetActiveView()->GetDocument();
(not sure if those names are correct)
This works only if the view the control belongs to is active. This means it may not always work and therefore is no good way.

b) Add a member to your derived class where you store a pointer to the document. Pass that pointer at creation time. Works only if you have access to the document at this time, but you usually should have.