Print Page | Close Window

CXTPStatusBar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=11325
Printed Date: 21 December 2024 at 10:04pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPStatusBar
Posted By: VolkerE
Subject: CXTPStatusBar
Date Posted: 07 July 2008 at 5:52am
Hello,
 
I made he same experience as posted by Guybrush ( https://forum.codejock.com/forum_posts.asp?TID=10432 - https://forum.codejock.com/forum_posts.asp?TID=10432 ) when using CXTPStatusBar::SetPaneText().
The problem can be easily reproduced using the MDITextEditor sample:
 
1. In MainFrm.h add a method to access the status bar member:
 
   CXTPStatusBar& GetStatusBar(){return ( m_wndStatusBar );};
2. In CMDITextEditorApp::OnFileOpen() display the path of each file as it is being opened:

   if (!ActivateExisting(csFilePath))
   {
    CString status;
    status.Format("Opening file: %s ...", csFilePath);
    m_pMainFrame->GetStatusBar().SetPaneText(0, status);
    
    m_pDocTemplate->OpenDocumentFile(csFilePath);
   }
After building this with ToolKitPro 11.2.2 select a couple of files to be opened: you will see the status bar updated for each file being opened.
Trying the same with 12.0.0 or 12.0.1 gives a different result: the status text will never be displayed, there is always the standard "Ready" status visible!
 



Replies:
Posted By: Simon HB9DRV
Date Posted: 07 July 2008 at 6:02am
I think the 12.0.x behaviour is in fact correct, you should really use an onupdate handler to update status bar panes.

-------------
Simon HB9DRV


Posted By: Oleg
Date Posted: 08 July 2008 at 6:35am
Hi,
 
Try
 
  m_pMainFrame->SetMessageText(status);
 
instead.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: VolkerE
Date Posted: 08 July 2008 at 6:54am
Hi Oleg,
 
I did try, but it doesn't help. SetMessageText() will also call
XTPStatusBar::SetPaneText() finally, and has the same effect: the new text will not display


Posted By: Smucker
Date Posted: 08 July 2008 at 8:32am
GetStatusBar()->UpdateAllPanes(TRUE, TRUE);

(FALSE, TRUE) if you don't want the rectangles to be adjusted.


-------------
Product: Xtreme Toolkit Pro version 13.2 (Unicode, static build)

Platform: Windows 200x/XP/Vista/Win7 (32/64 bit)

Language: Visual C++ 9.0 (Studio 2008)



Posted By: VolkerE
Date Posted: 08 July 2008 at 9:02am
Hi Smucker,
 
thank you, but this is already in my real application, where I encountered the problem. I just now tried it in the MDITextEditor sample, with no effect.
In the current 12.2.x implementation the second argument 'bUpdateText' of UpdateAllPanes() is ignored, and the method will do nothing if the the first argument is FALSE:

void CXTPStatusBar::UpdateAllPanes(BOOL bUpdateRects, BOOL /*bUpdateText*/)
{
 if (bUpdateRects)
 {
  RecalcLayout();
 }
}
 
Thanks anyway,
Volker


Posted By: Smucker
Date Posted: 08 July 2008 at 12:15pm
Strange. I wonder why I'm not seeing the problem. I derive my status bar class from CXTPStatusBar, and include member pointers to the panes.

Below is my code for my "doing" status pane (added using AddIndicator()). It updates during long operations, such as reading a folder. Perhaps it's one of the other methods that's making it display. I also have several other indicator panes, and don't have any problems with them either.

None of my panes has an ID of zero. I think I remember reading here that CJ handles them differently.

void CtpStatusBar::StatusDoing(LPCTSTR text, BOOL append)
{
  if (m_pdoing) {
    if (text && text[0]) {
      if (append)
        m_doing += text;
      else
        m_doing = text;
      m_pdoing->SetText(m_doing);
      m_pdoing->SetVisible(TRUE);
    } else {
      m_doing = _T("");
      m_pdoing->SetText(_T(""));
      m_pdoing->SetVisible(FALSE);
    }
    m_pdoing->BestFit();
    PositionControls();
    UpdateAllPanes(TRUE, TRUE);
  }
}

m_pdoing is defined as:

  CXTPStatusBarPane* m_pdoing;

And it is created using:

   AddIndicator(m_pdoing = new CXTPStatusBarPane(), SID_DOING, 3);




-------------
Product: Xtreme Toolkit Pro version 13.2 (Unicode, static build)

Platform: Windows 200x/XP/Vista/Win7 (32/64 bit)

Language: Visual C++ 9.0 (Studio 2008)



Posted By: rdhd
Date Posted: 08 April 2009 at 11:37am
After calling SetPaneText, call SendMessage( WM_PAINT ) to force the paint to occur in real time. Otherwise the user may not see all of the messages your are trying to set when there is no message processing between calls. For instance, if you call SetPaneText a number of times while doing extensive processing, the user will only see the last message when your processing is done and you the system returns to the message loop and starts dispatching the messages.


Posted By: VolkerE
Date Posted: 09 April 2009 at 3:33am
Hi,
 
thanks a lot, this helped!
 
Regards,
Volker



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net