Thread: My Status Bar Issue. Need Help.

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    48

    My Status Bar Issue. Need Help.

    Hi,

    Good day.

    I got a problem about My Status bar.
    Current Capture: attached Tool.jpg.
    When i changed the size of my window. The Status bar can't move...
    Issue Capture: attached too Tool1.jpg.

    I add the code at my resource file.

    Any help will be appreciated.



    AppResource.rc
    Code:
    	EDITTEXT        IDC_VIEW_SESSION_NAME,6,297,301,11,WS_DISABLED
    AppDlg.cpp
    // The Tree Control right at top of the my Status Bar.
    Code:
    CRect MyAppDlg::GetTreeRect()
    {
    	CRect rect, rectHead;
    	GetClientRect(&rect);
    
    	rectHead.left = static_cast<int>(rect.left + rect.Width() * 0.02);
    	rectHead.top = static_cast<int>(rect.top + 95);
    	rectHead.right = static_cast<int>(rect.left + rect.Width() * 0.98);
    	rectHead.bottom = static_cast<int>(rect.top + rect.Height() * 0.95);
                    
    	return rectHead;
    
    }
    Last edited by userpingz; 10-15-2009 at 03:53 AM.
    --------------------------------------------------------
    Newbie
    C/C#/C++
    swimming/cycling/running
    There is nothing more powerful than an idea.
    Except for an idea put into action.
    --------------------------------------------------------

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Can you post your OnSize() handler?
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    48
    Code:
    void MyAppDlg::OnSize(UINT nType, int cx, int cy)
    {
    	if(m_bInit == true)
    	{
    		
    		m_TreeCommand.MoveWindow(GetTreeRect(), TRUE);
    	}
    
    	Invalidate();
    
    	CDialog::OnSize(nType, cx, cy);
    	if ( !IsWindowVisible() )
    		return;
    }
    Thanks a lot.
    --------------------------------------------------------
    Newbie
    C/C#/C++
    swimming/cycling/running
    There is nothing more powerful than an idea.
    Except for an idea put into action.
    --------------------------------------------------------

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    I can't see the code where you move the status window (only the Treeview).

    Is the status bar a child of the dialog or the treeview? (appears to be treeview where it should be the Dialig, or CMainFrame if you want the MFC OnSize to auto handle the resize).
    Last edited by novacain; 10-18-2009 at 10:50 PM.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Registered User
    Join Date
    Mar 2009
    Posts
    48
    @novacain, thank you.

    Acturally, The status bar added by mysel. TreeView is a existed Controlor for my Application.
    I think i want to handle my Status bar with the CMainFrame.

    I don't want to add some status bar code in the TreeView controlor.

    But i don't know how to...
    --------------------------------------------------------
    Newbie
    C/C#/C++
    swimming/cycling/running
    There is nothing more powerful than an idea.
    Except for an idea put into action.
    --------------------------------------------------------

  6. #6
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    You need to write a resize handler for the status bar (similar to the one you have for the Treeview).

    Make the Status bar a child and a member variable of the MainApp (just like the Treeview).

    Call both the size handlers (Treeview and Status bar) in the main apps OnSize().
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  7. #7
    Registered User
    Join Date
    Dec 2007
    Posts
    214
    Is there a reason you aren't using the CStatusBar class?

  8. #8
    Registered User
    Join Date
    Mar 2009
    Posts
    48

    Smile

    @novacain. Thanks a lot for your guide. I would try it right now.

    @DaveH. Thank you too. Yes, i still didn't use the CStatusBar class. I plan to learn it soon.
    --------------------------------------------------------
    Newbie
    C/C#/C++
    swimming/cycling/running
    There is nothing more powerful than an idea.
    Except for an idea put into action.
    --------------------------------------------------------

  9. #9
    Registered User
    Join Date
    Dec 2007
    Posts
    214
    CStatusBar will have the functionality you are looking for, built into the class. Less headaches, but there is a lot of value in doing things yourself.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. status bar flickering
    By rakan in forum Windows Programming
    Replies: 5
    Last Post: 01-07-2008, 10:11 PM
  2. beach bar (sims type game)
    By DrKillPatient in forum Game Programming
    Replies: 1
    Last Post: 03-06-2006, 01:32 PM
  3. Status bar
    By maxorator in forum Windows Programming
    Replies: 3
    Last Post: 11-06-2005, 11:45 AM
  4. Troubles with Sockets
    By cornholio in forum Windows Programming
    Replies: 6
    Last Post: 10-26-2005, 05:31 AM
  5. Disabling "Ready" & Other Auto Status Bar Updates :: MFC
    By kuphryn in forum C++ Programming
    Replies: 1
    Last Post: 04-03-2002, 08:51 PM

Tags for this Thread