Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - CXTPStatusBar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPStatusBar

 Post Reply Post Reply
Author
Message
Surbhi View Drop Down
Groupie
Groupie


Joined: 08 July 2008
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote Surbhi Quote  Post ReplyReply Direct Link To This Post Topic: CXTPStatusBar
    Posted: 15 July 2008 at 12:44am
Hi,
I want to create a button on status Bar, and add functionality to it in a Dialog Application.
Please can you guide me proper steps for it.
Thanking in anticipation,
Regards,
Surbhi Mehta
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 15 July 2008 at 9:23am
Hi,
 
Just add simple pane and call pPane->SetButton(TRUE);
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Surbhi View Drop Down
Groupie
Groupie


Joined: 08 July 2008
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote Surbhi Quote  Post ReplyReply Direct Link To This Post Posted: 15 July 2008 at 11:20pm
Dear Sir,
Thanks a lot for the input. But even trying out your solution is causing the Dialog  Application to crash. I have created a a function CreateStatusBar() and calling it in OnInitDialog(). Sir Could you please provide me with more inputs if possible. I will be very grateful to you.
Thanking you in anticipation,

Best Regards,
Surbhi Mehta
Software Developer.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 16 July 2008 at 1:09am
Hi,
Attach what you have with crush. I will show how to fix it.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Surbhi View Drop Down
Groupie
Groupie


Joined: 08 July 2008
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote Surbhi Quote  Post ReplyReply Direct Link To This Post Posted: 16 July 2008 at 1:54am
Dear Sir,
Thanks for the input. Here is the code
//Declaration
        CXTPStatusBar m_wndStatusBar;
        CXTPStatusBarPane* pPane;

//Implementation
BOOL CDialogSampleDlg::CreateStatusBar()
{
    if (!m_wndStatusBar.Create(this))
    {
        TRACE0("Failed to create status bar\n");
        return FALSE;      // fail to create
    }

    pPane = m_wndStatusBar.AddIndicator(0);
    pPane->SetWidth(100);
    pPane->SetStyle(SBPS_STRETCH | SBPS_NOBORDERS);
    pPane->SetBeginGroup(TRUE);
     
    pPane = m_wndStatusBar.AddIndicator(IDC_BTN_FIRST_STATUS,1);
    pPane->SetText(_T("First"));
    pPane->SetButton(TRUE);
    pPane->SetPadding(50, 0, 50, 0);
    pPane->SetWidth(pPane->GetBestFit());

    return TRUE;
}

//Calling
BOOL CDialogSampleDlg::OnInitDialog()
{
    CDialog::OnInitDialog();


    if (!CreateStatusBar())
        return -1;

    if (!InitCommandBars())
        return -1;
   
    CXTPCommandBars* pCommandBars = GetCommandBars();
    m_wndStatusBar.SetCommandBars(pCommandBars);

return TRUE;
}

Sir  on the  click of  button  it  crashes  ,  Even though I had handled
its  event 

ON_COMMAND(IDC_BTN_FIRST_STATUS, OnBtnFirst)

In OnBtnFirst I had implemented A MessageBox only.
Sir could  you  please guide me about change of Class or anything.
Thanking you in anticipation,
Best Regards,
Surbhi Mehta
Software Developer
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 16 July 2008 at 5:50am

Hi,

 
Not sure why you have CXTPStatusBarPane* pPane in class declaration but think it can be reason.
 
declare it in method:
 
 CXTPStatusBarPane* pPane= m_wndStatusBar.AddIndicator(0);

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Surbhi View Drop Down
Groupie
Groupie


Joined: 08 July 2008
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote Surbhi Quote  Post ReplyReply Direct Link To This Post Posted: 16 July 2008 at 7:10am
Dear Sir,
Thanks alot for the input.I implemented your suggestion. But still the crash is persistent. Sir could you  please  send  me  a  Dialog Based  Sample which has a status bar with a button and its event is handled. I am sure it would be of great help to me.
Thanking you in anticipation,
Surbhi  Mehta
Software Developer.
uploads/20080716_081933_mydialog.zip
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 16 July 2008 at 1:23pm
Hello,
 
Now you're right :( Buttons in statusbar assumes statusbar located in Frame.
 
Please add small derived class
 

class CMyStatusBar : public CXTPStatusBar

{

void OnPaneClick(CXTPStatusBarPane* pPane)

{

GetParent()->SendMessage(WM_COMMAND, pPane->GetID());

}

};

 

and replace

CXTPStatusBar m_wndStatusBar;

to

CMyStatusBar m_wndStatusBar;

it will be fixed in next release
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Surbhi View Drop Down
Groupie
Groupie


Joined: 08 July 2008
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote Surbhi Quote  Post ReplyReply Direct Link To This Post Posted: 18 July 2008 at 2:01am
Dear Sir,
Thanks a lot for the input. My problem is solved I am very grateful to you.
Best Regards,
Surbhi Mehta
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.