CXTPStatusBar |
Post Reply |
Author | |
Surbhi
Groupie Joined: 08 July 2008 Status: Offline Points: 15 |
Post Options
Thanks(0)
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 |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Just add simple pane and call pPane->SetButton(TRUE);
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Surbhi
Groupie Joined: 08 July 2008 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
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. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Attach what you have with crush. I will show how to fix it.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Surbhi
Groupie Joined: 08 July 2008 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
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 |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
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 |
|
Surbhi
Groupie Joined: 08 July 2008 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
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 |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
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; toCMyStatusBar m_wndStatusBar; it will be fixed in next release |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Surbhi
Groupie Joined: 08 July 2008 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
Dear Sir,
Thanks a lot for the input. My problem is solved I am very grateful to you. Best Regards, Surbhi Mehta |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |