Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. reactivate the view in an SDI app

reactivate the view in an SDI app

Scheduled Pinned Locked Moved C / C++ / MFC
questioncsharpdatabasevisual-studiohardware
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    luedi
    wrote on last edited by
    #1

    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

    B 1 Reply Last reply
    0
    • L luedi

      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

      B Offline
      B Offline
      Brian Shifrin
      wrote on last edited by
      #2

      ...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

      L 1 Reply Last reply
      0
      • B Brian Shifrin

        ...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

        L Offline
        L Offline
        luedi
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups