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. MDI Application How to change Views Title

MDI Application How to change Views Title

Scheduled Pinned Locked Moved C / C++ / MFC
visual-studiotutorialcsharpquestion
4 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.
  • M Offline
    M Offline
    Member 8534035
    wrote on last edited by
    #1

    Hi, step by step I am creating a Visual Studio Style IDE Project, but I am running in a bunch of problems. My application is MDI based, created in Visual Studio Style with Project Wizard. Further I added functionality for viewing different views for each document. For this views I need to set an application specific Windows title. Actually I found hints how to solve:

    BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
    cs.style &= ~(LONG) FWS_ADDTOTITLE;
    return CFrameWnd::PreCreateWindow(cs);
    ...

    CMyView::OnInitialUpdate()
    {
    CView::OnInitialUpdate();
    GetParent()->SetWindowsText(_T("myText"));

    But it works only partially. The default view's title disappears, but my own one is not displayed. The title in the tab header is empty after the changes. Maybe it is because my view is a splitter view or the ChildFrame is with a Tab Control. I have no idea, how to solve. Anybody, who has an idea? Many Thanks!

    D 1 Reply Last reply
    0
    • M Member 8534035

      Hi, step by step I am creating a Visual Studio Style IDE Project, but I am running in a bunch of problems. My application is MDI based, created in Visual Studio Style with Project Wizard. Further I added functionality for viewing different views for each document. For this views I need to set an application specific Windows title. Actually I found hints how to solve:

      BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
      {
      cs.style &= ~(LONG) FWS_ADDTOTITLE;
      return CFrameWnd::PreCreateWindow(cs);
      ...

      CMyView::OnInitialUpdate()
      {
      CView::OnInitialUpdate();
      GetParent()->SetWindowsText(_T("myText"));

      But it works only partially. The default view's title disappears, but my own one is not displayed. The title in the tab header is empty after the changes. Maybe it is because my view is a splitter view or the ChildFrame is with a Tab Control. I have no idea, how to solve. Anybody, who has an idea? Many Thanks!

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Member 8534035 wrote:

      GetParent()->SetWindowsText(_T("myText"));

      Does this even compile? Have you seen this?

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

      M 2 Replies Last reply
      0
      • D David Crow

        Member 8534035 wrote:

        GetParent()->SetWindowsText(_T("myText"));

        Does this even compile? Have you seen this?

        "One man's wage rise is another man's price increase." - Harold Wilson

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

        M Offline
        M Offline
        Member 8534035
        wrote on last edited by
        #3

        uups...sorry...the source code I have written manually on the post, because my development environment is on another computer. but in principal it is according to what I have programmed

        1 Reply Last reply
        0
        • D David Crow

          Member 8534035 wrote:

          GetParent()->SetWindowsText(_T("myText"));

          Does this even compile? Have you seen this?

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

          M Offline
          M Offline
          Member 8534035
          wrote on last edited by
          #4

          oh...many thanks for the link! finally it works now! according to the link I override:

          void CMainFrame::OnUpdateFrameTitle( BOOL bAddToTitle )

          but this is affecting the application main title. but overriding

          void CChildFrame::OnUpdateFrameTitle( BOOL bAddToTitle )

          does exactely what I need! many thanks for your help! I searched already at least 2 hours for a solution!

          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