Getting and Setting Toolbar Characteristics

In addition to the toolbar information mentioned in Getting and Setting Toolbar Information, other toolbar characteristics can be modified. These include toolbar visibility, position and the number of rows present in the toolbar.

A toolbar can be made visible or hidden using L_TBSetVisible. To determine whether the toolbar is visible or hidden, call L_TBIsVisible.

The position of the toolbar can be changed using L_TBSetPosition. This function allows the user to specify a point and orient the toolbar around that point. To get the current position, call L_TBGetPosition.

The number of rows in the toolbar can also be set. This is done using the L_TBSetRows function. However, the number of rows cannot exceed the number of buttons in the toolbar. To determine the current number of rows in the toolbar, call L_TBGetRows.

The following example gets the current number of rows in the toolbar. If it's not 2, then it will make 2 rows:

L_INT SetToolbarRows ( pTOOLBARHANDLE pLeadToolbar )
{
    if (SUCCESS == L_TBIsValid ( pLeadToolbar ) ) /* check the validity of the toolbar handle */
    {
       L_INT nRow ;

       /* Get the number of rows in the toolbar */
       L_TBGetRows ( pLeadToolbar, &nRow ) ;

       if ( nRow != 2 )
       {
          /* Set the number of rows to 2 */
          L_TBSetRows ( pLeadToolbar, 2 ) ;
       }

       return SUCCESS ;
    }
    else
    {
       return FAILURE ;
    }
}

 

A toolbar can also be changed by changing the buttons contained in the toolbar. For more information about functions that affect toolbar buttons, refer to Getting and Setting Toolbar Button Information.