Status Bar Home

The status bar is used to display cursor coordinates and other infoemation. In Litecad.exe program status bar is placed at bottom side of a design window (see the picture below).




These are functions for Status Bar object:

Function Meaning
lcCreateStatbar Creates status bar object
lcDeleteStatbar Deletes status bar object
lcStatbarResize Sets size and position
lcStatbarCell Defines text fields
lcStatbarText Sets text contents
lcStatbarRedraw Redraws status bar

The Status Bar object has the following properties:

Property Type Access Meaning
LC_PROP_SBAR_H int RW Status bar window height, pixels. Default value is LC_PROP_G_SBARHEIGHT
LC_PROP_SBAR_FONTNAME string RW Font name
LC_PROP_SBAR_FONTSIZE int RW Font size
LC_PROP_SBAR_TEXTY int RW Distance between top of status bar and top of text
LC_PROP_SBAR_TEXTCOLOR int RW Text color
LC_PROP_SBAR_BGCOLOR int RW Background color
LC_PROP_SBAR_FRAMECOLOR int RW Border line color


Code sample:
from \LC_Samples\LaserDraw\  project

HANDLE   g_hStatBar;    // status bar

//-----------------------------------------------
int APIENTRY _tWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
  ...
  // Create StatusBar
  g_hStatBar = lcCreateStatbar( g_hwMain );
  lcStatbarCell( g_hStatBar, 1, 0 );
  lcStatbarCell( g_hStatBar, 2, 100 );
  lcStatbarCell( g_hStatBar, 3, 200 );
  lcStatbarCell( g_hStatBar, 4, 350 );
  ...
}

//-----------------------------------------------
void OnAppResize (WPARAM SizeType, int Wmain, int Hmain)
{
  int x, y, w, h, Hsbar;

  // Default height of the status bar
  Hsbar = lcPropGetInt( 0, LC_PROP_G_SBARHEIGHT );
  ...
  // StatusBar position
  x = 0;
  y = Hmain - Hsbar + 1;
  w = Wmain;
  h = Hsbar;
  lcStatbarResize( g_hStatBar, x, y, w, h );
}

//-----------------------------------------------
void OnMouseMove (HANDLE hEvent)
{
  ...
  // Display data in status bar
  // X
  okDblToStr( X, szNum, 2 );
  swprintf( szBuf, L"X: %s", szNum );
  lcStatbarText( g_hStatBar, 1, szBuf );
  // Y
  okDblToStr( Y, szNum, 2 );
  swprintf( szBuf, L"Y: %s", szNum );
  lcStatbarText( g_hStatBar, 2, szBuf );
  // redraw the status bar
  lcStatbarRedraw( g_hStatBar );
}