Click to See Complete Forum and Search --> : Pointers to views/calling class functions


Dan Fish
April 18th, 1999, 03:28 AM
One of the things I've found most difficult about learning this strange new language is getting pointers to the instances of the classes being used so as to call their member functions! (Am I just thick, or is this generally a problem for beginners? :) For example, I've got a basic class-wizard generated MDI app. I've created a static splitter wnd and then a second splitter wnd from one-half of the first one. (3 panes total). I've derived my own classes (2 list views and form view). All fine and well thus far... In the class-wizard generated "Doc" class, I've mapped ID_FILE_OPEN to a "OnFileOpen" function which works fine. Once I get the name of the file though, I want to call a member function of one of the views I created to do some processing on the file. How do I get a pointer to the view so I can call the member function?

Any general tips greatly appreciated!

I'm a veteran ANSI C programmer, but this is my first stint with "event-driven" programming. I know what I want to do, but getting it done in this windows environment is proving to be very frustrating!

Thanks!
-Dan

Fabian
April 18th, 1999, 03:46 PM
Hi, you don't need a pointer to a view. Each time the document is modified you should call CDocument::UpdateAllViews, and you should implement CView::OnUpdate on all the views in your application.
lHint contains information about t

chris law
April 19th, 1999, 05:51 AM
Or you can enumerate the views of your document.
use GetFirstViewPosition, GetNextView and CRuntimeClass information to determine which view you have...

G'things

chrislaw