Click here to Skip to main content
15,920,110 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CBitmap from file Pin
Michael Dunn18-Sep-02 5:12
sitebuilderMichael Dunn18-Sep-02 5:12 
GeneralPreviously selected Index of Combobox Pin
Vijayalakshmi17-Sep-02 22:48
Vijayalakshmi17-Sep-02 22:48 
GeneralRe: Previously selected Index of Combobox Pin
[James Pullicino]17-Sep-02 23:18
[James Pullicino]17-Sep-02 23:18 
GeneralMoving class files from C++ to VC++ Pin
oRion17-Sep-02 22:42
oRion17-Sep-02 22:42 
GeneralRe: Moving class files from C++ to VC++ Pin
Michael P Butler17-Sep-02 23:11
Michael P Butler17-Sep-02 23:11 
GeneralRe: Moving class files from C++ to VC++ Pin
oRion19-Sep-02 3:35
oRion19-Sep-02 3:35 
QuestionWhere to place handler? CView/CDoc/Mainfrm? Pin
oRion17-Sep-02 22:31
oRion17-Sep-02 22:31 
AnswerRe: Where to place handler? CView/CDoc/Mainfrm? Pin
[James Pullicino]17-Sep-02 22:48
[James Pullicino]17-Sep-02 22:48 
Document hold document data
Main Frame is the main applications window
Views are windows which display the documents data and are children of the Main Frame.

I am assuming that by 'handlers' you are reffering to message handlers.

You have two options: either put your handlers in your Main Frame, or put your handlers in your View. Very rarely will you need to add handlers to your Document since it does not make too much sense.

In reality you will be putting handlers in both your mainframe and your views. Do you want your handler to work in every view or in only one type of view (this is only applicable when you have multiple views, i.e. MDI application). If you want a 'global' handler then add it to your main frame, if you want a 'local' handler (local to a view type), then add the handler to your view.

Also consider the type of access you need in your handler. If you need access to the Document data for example, it will be easier to put your handler inside your view since access to the document from a view is easier than from the main frame. This applies mostly to MDI applications. (SDI applications are much simpler since you can assume only one document, thus making it easier to locate from the mainframe)

In summery, treat every handler differently. Think about what the handler will be used for (logically) so that you can decide whether it should be a 'global' or 'local' handler. Think about the access requirements (do you need access to the document? Do you need access to the MainFrame?). One final tip: Observe and learn the code which ClassWizard generates so that you can modify it and move it around if neccessary.

James Pullicino




Drinking In The Sun
Forgot Password?
AnswerRe: Where to place handler? CView/CDoc/Mainfrm? Pin
jhwurmbach17-Sep-02 22:55
jhwurmbach17-Sep-02 22:55 
GeneralRe: Where to place handler? CView/CDoc/Mainfrm? Pin
oRion18-Sep-02 4:56
oRion18-Sep-02 4:56 
GeneralRe: Where to place handler? CView/CDoc/Mainfrm? Pin
jhwurmbach18-Sep-02 5:25
jhwurmbach18-Sep-02 5:25 
QuestionHow to create Tree Control in leftview of SDI ?? Pin
HiOctane17-Sep-02 22:01
HiOctane17-Sep-02 22:01 
AnswerRe: How to create Tree Control in leftview of SDI ?? Pin
[James Pullicino]17-Sep-02 22:54
[James Pullicino]17-Sep-02 22:54 
GeneralAssigning values to LPCWSTR Pin
abhinarulkar17-Sep-02 21:40
abhinarulkar17-Sep-02 21:40 
GeneralRe: Assigning values to LPCWSTR Pin
includeh1017-Sep-02 21:52
includeh1017-Sep-02 21:52 
GeneralRe: Assigning values to LPCWSTR Pin
Stephane Rodriguez.17-Sep-02 22:00
Stephane Rodriguez.17-Sep-02 22:00 
GeneralRe: Assigning values to LPCWSTR Pin
Anonymous17-Sep-02 22:07
Anonymous17-Sep-02 22:07 
GeneralClipboard & Lines :: MFC Pin
valikac17-Sep-02 21:12
valikac17-Sep-02 21:12 
GeneralRe: Clipboard & Lines :: MFC Pin
Steve S17-Sep-02 21:24
Steve S17-Sep-02 21:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.