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


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 );
}