Show scrolling text in a status bar pane

This simple trick uses string pointer manipulation to give scrolling effect in a status bar. The code is not robust. It only demonstrates how it could be done.

1. Derive your own CMyStatusBar from CstatusBar.

2. In MainFrm.h, change the type of status bar as:

	CMyStatusBar m_wndStatusBar;

3. Also change the indicator array in MainFrm.cpp as:
	static UINT indicators[] =
	{
		ID_SEPARATOR, 
		IDS_SCROLL_PANE,				//scrolling text
		ID_INDICATOR_CAPS,
		ID_INDICATOR_NUM,
		ID_INDICATOR_SCRL,
	};

4. Add IDS_SCROLL_PANE in the string table with few blanks. The size of pane will depend on this blank string. There are other painfull ways of sizing a pane too.

5. Add following member to CMyStatusBar: Cstring m_strScrollText;

6. Add OnTimer() to the CMyStatusBar:

void CMyStatusBar::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	
	if (m_strScrollText.IsEmpty())
	{
		KillTimer(1);
		SetPaneText(CommandToIndex(IDS_SCROLL_PANE), "");
		return;
	}
	static UINT str_idx = 0;        //offset into string
	
	//if end of string, return to top
	if (str_idx >= (UINT) (m_strScrollText.GetLength() / 2) - 1)
	{
		str_idx = 0;
	}
	
	//display string
	SetPaneText(CommandToIndex(IDS_SCROLL_PANE), ((LPCSTR) 
		m_strScrollText)+str_idx); 
	
	//scroll one character
	str_idx = str_idx + 1;
	
	CStatusBar::OnTimer(nIDEvent);
}

7. Destroy timer:

void CMyStatusBar::OnDestroy() 
{
	CStatusBar::OnDestroy();
	
	// TODO: Add your message handler code here
	
	KillTimer(1);
}

8. Add a method to start scrolling text. This method must be called after the mainframe (and the status bar) has been constructed to display scrolling text. Perhaps from the CWinApp::InitInstance().

void CMyStatusBar::StartDisplay(void) 
{
	//set text for scrolling
	m_strScrollText = "   Hello! World.   "
		
		//to make it circular scroll
		m_strScrollText += m_strScrollText;
	
	KillTimer(1);
	VERIFY(SetTimer(1, 200, NULL) != 0);    //timer
}



Comments

  • GHD barato podría hacer la mejor cantidad de calor para adquirir el mejor efecto

    Posted by hanmeihm on 05/30/2013 03:19pm

    [url=http://www.ghdchheapoutlet.moonfruit.com/]Planchas ghd[/url] Estas planchas rojas tienen un significado doble voltaje se puede obtener un rendimiento uniforme en todo el mundo ideal para cuando vas en sus viajes. Tambin con un sistema incorporado en el modo de suspensin tus alisadores poco a poco se empiezan a cerrar despus de 30 minutos de haber sido utilizado C que le ahorra la preocupacin de si est¢ o no les apag! [url=http://www.comprar-ghd.manifo.com/]Comprar ghd[/url] La plancha de barro sin duda sellar la cutcula del pelo que pasa en el que la consistencia f¢cil y brillante que le gustara, as como eliminar el rizo no es necesario, si usted decide aadir otras. Adem¢s, incluye una funcin susceptible de proteccin que lo hace inmediatamente despu¦s de apagar en realidad no acostumbrarse sobre media hora. [url=http://www.planchasespanaghdtop.net/ghdtienda/]GHD Plancha pelo[/url] La primera straightner ghd era b¢sicamente aos antes de la competitividad ltimos dos mil. Planchas para el pelo durante ese tiempo el peso placas de aluminio muy ligeros y un montn de sauna elegido como medida para encontrar la mejor apariencia. La clave en la parte trasera de la m¢s alta eficacia de su ghd era b¢sicamente la derecha abajo a varios elementos principales.

    Reply
  • Jordan shoes mentioned Gene to buy the variety, a disunion of Nike

    Posted by TaddyGaffic on 04/20/2013 12:12pm

    The sole of shoes are made from high quality rubber material and come with the lining. One can easily search for Vans footwear in the various online stores where they are easily available at great discount prices. These come in almost an infinite amount of [url=http://northernroofing.co.uk/roofins.cfm]nike free uk[/url] color and are usually on the cheap side. Experts as well as the rights of employees in regards to the apple can annihilate the Nike Air Max For travel arrangements in developing abjection can be a acceptable accord added in comparison to they're prevention, nonetheless they do accommodate sports sports athletes while using high duke inside their profession. Bargain Nike Air Max 2009 aswell provides countless jobs inside the nations absolutely area it's hardly accessible to acquire a job. In Indonesia, for archetype nike air max 90, even acknowledging baby assets [url=http://northernroofing.co.uk/roofins.cfm]nike free run 3[/url] in barter for plan Air Max, however, Nike bargain shoes inside a aught bulk adaptation and utilisation of the circadian needs.. Nike Zoom Vapor VI Tour Men`s tennis shoe is a great shoe popular in the tennis courts. It has Fly wire upper for ultra support and light weight ability, it sits on a frame that gives extra heel support and contains a full-length durable rubber support and herring bone pattern. It also has extra traction for all surfaces of play.. Write a Shakespeare Sonnet without any effort! Express loving [url=http://northernroofing.co.uk/roofins.cfm]nike free uk[/url] feelings in a sonnet in Shakespeare's own words in 15 minutes. The rhyme scheme of a Sonnet is a,b,a,b,c,d,c,d,e,f,e,f,g,g. Think of a theme like "love" "death" or "deceit", then choose your lines in the rhyme pattern and put a Sonnet together using the programme

    Reply
  • desktop

    Posted by Legacy on 08/05/1999 12:00am

    Originally posted by: atif

    do u know how to display on desktop client area not in application client area

    • Take a look!

      Posted by owuag on 12/03/2008 09:03pm

      Check

      Reply
    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • VMware vCloud® Government Service provided by Carpathia® is an enterprise-class hybrid cloud service that delivers the tried and tested VMware capabilities widely used by government organizations today, with the added security and compliance assurance of FedRAMP authorization. The hybrid cloud is becoming more and more prevalent – in fact, nearly three-fourths of large enterprises expect to have hybrid deployments by 2015, according to a recent Gartner analyst report. Learn about the benefits of …

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

Most Popular Programming Stories

More for Developers

RSS Feeds