reactivate the view in an SDI app
-
Hi, how can I reactivate the one and only view of the one and document in a SDI app? A little explanation why I must do this: I have a standard SDI application and added a ControlBar with an embedded CEditView latetly. The problem is, that this EditView will activate itself within the MainFrame if you click on it. I need the possibility to reactive the View of the main document programatically if I want to do some view dependant processing, for example closing the app. Closing the app e.g. will query the active view wether the underlying document has changed. If I have the wrong view active (e.g. the CEditView), this message is send to the wrong document. As a second example: The CEditView is a LogConsole for my application. If I have activated the CEditView, e.g. with a mouseclick I want to reactivate the main SDI view with the ESC key like the Output Control bar in the Visual Studio. But how do I find the document to send the Acitvation command to? In a MDI application there is the MDIGetActive() window, i think, but there seems to be no such window handle in a SDI application. I thought about hooking somewhere into the InitialUpdateFrame or OnCreateClient procedure, and safe the created view from there. But I'm sure wether this is safe, also when I have opened different documents. Thanks for any ideas. Dirk
-
Hi, how can I reactivate the one and only view of the one and document in a SDI app? A little explanation why I must do this: I have a standard SDI application and added a ControlBar with an embedded CEditView latetly. The problem is, that this EditView will activate itself within the MainFrame if you click on it. I need the possibility to reactive the View of the main document programatically if I want to do some view dependant processing, for example closing the app. Closing the app e.g. will query the active view wether the underlying document has changed. If I have the wrong view active (e.g. the CEditView), this message is send to the wrong document. As a second example: The CEditView is a LogConsole for my application. If I have activated the CEditView, e.g. with a mouseclick I want to reactivate the main SDI view with the ESC key like the Output Control bar in the Visual Studio. But how do I find the document to send the Acitvation command to? In a MDI application there is the MDIGetActive() window, i think, but there seems to be no such window handle in a SDI application. I thought about hooking somewhere into the InitialUpdateFrame or OnCreateClient procedure, and safe the created view from there. But I'm sure wether this is safe, also when I have opened different documents. Thanks for any ideas. Dirk
...Why in the world are you using CEditView???... Sounds like all your problems would go away if you just switch to plain edit. CEditView is there to support view & document stuff, you seems to not want either? ( You are using SDI, EditView stuffed in control bar most likely has some other document ) So either use plain Edits or switch to MDI and limit it to single document, remove windows menu, get rid of close view. Brian
-
...Why in the world are you using CEditView???... Sounds like all your problems would go away if you just switch to plain edit. CEditView is there to support view & document stuff, you seems to not want either? ( You are using SDI, EditView stuffed in control bar most likely has some other document ) So either use plain Edits or switch to MDI and limit it to single document, remove windows menu, get rid of close view. Brian
Hi, because the CEditView can do FindText out of the box. I know, you can always implement that yourself, but why should I. Only because MFC does a tight coupling between Views and the Frame? There are thousands of reasons, why someone does this or that. I tried converting my application to an MDI app. With the result, that this is as much trouble, than sticking with an SDI app. Views are the same thing than Controls. Only that they have an attached document (which is no problem), and that they talk to the frame directly (which is a problem). There is no bad thing about using Views as Controls. Thing for example at the CScrollView. I can think of a lot of Controls that could need scrolling capabilites. Why shouldn't I use a CScrollView as the base class for such controls. And now think of a CFrameView that has these CScrollView derived controls on them. Boom, you get the same problem if you click on this control. I would have derived my controls from a CScrollCtrl if there was one, but there wasn't. I would have used a CEditCtrl that can do FindText, if there was one, but there wasn't ;-) Dirk