Creating a Toolbar
After initializing the toolbar handle, the toolbar must be created using the LToolbar::Create function. The toolbar is created in a regular child window. The user has the option of creating a toolbar "from scratch" and entering the desired buttons, or the user may create a Vector or Paint toolbar, complete with a predefined set of buttons. The following example shows how to create a toolbar:
/* Global LEAD toolbar handle */
pTOOLBARHANDLE g_pLeadToolbar ;
LToolbar tlb;
L_INT ToolbarTest ( HWND hWnd )
{
/* Initiate the toolbar handle */
tlb.Initialize() ;
/* Check the validity of the handle */
if ( tlb.IsValid () )
{
POINT pt = { 0, 0 } ;
/* Initiate the point to be used to align the toolbar at the top-left of its owner client area */
ClientToScreen ( hWnd, &pt ) ;
/* Create the toolbar */
tlb.Create (hWnd, TEXT("Tools Window"), TOOLBAR_PAINT ) ;
/* Set the toolbar position */
tlb.SetPosition (&pt, TOOLBAR_POSITION_TOP | TOOLBAR_POSITION_LEFT ) ;
/* Show the toolbar */
tlb.SetVisible (TRUE ) ;
}
return SUCCESS ;
}