Show TOC Start of Content Area

Object documentation Tool Bar  Locate the document in its SAP Library structure

Definition

A toolbar provides quick and convenient access to a set of frequently used commands or options. A toolbar can contain buttons, input fields and dropdown list boxes. The toolbar offers a separator. The separator is a vertical line with padding on both sides and is used to space command groups.

The width of the toolbar is defined by the added controls (button, input field and so on). When the toolbar control is not used in a gridlayout or formlayout, it is always rendered in a new line.

·        addToolbarButton

Adds a button to the toolbar. The toolbar button is similar to the "button" control but has less attributes. See ToolbarButton description for more details.

·        addToolbarDropDownListBox

Adds a dropdown list box to the toolbar. See ToolbarDropDownListBox description for more details.

·        addToolbarInputField

Adds a input field to the toolbar. See ToolbarInputField description for more details.

·        addToolbarSeperator

Adds a vertical line with padding on both sides. The toolbar separator is used to space command groups. See ToolbarSeparator description for more details.

·        design

Sets the design of the toolbar. Possible values are:

¡        EMPHASIZED

Displays a toolbar with darker background.

¡        STANDARD

Displays a toolbar with lighter background.

·        id

Identification name of the toolbar.

 

Attributes

M

Values

Usage

addToolbarButton

 

String (cs)

Taglib
No tag available

Classlib
addToolbarButton("id", "text")

addToolbarDropDownListBox

*

String (cs)

Taglib
No tag available

Classlib
addToolbarDropDownListBox("id")

addToolbarInputField

 

String (cs)

Taglib
No tag available

Classlib
addToolbarInputField("id")

addToolbarSeparator

 

-

Taglib
No tag available

Classlib
addToolbarSeparator()

design

 

EMPHASIZED
STANDARD

Taglib
design="STANDARD"

Classlib
setDesign(ToolbarDesign.STANDARD)

id

*

String (cs)

Taglib
id="tb1"

Classlib
Object id.

 

Example

using the taglib

  <hbj:toolbar 
    id=
"toolbar" 
    
design="EMPHASIZED">
    <hbj:toolbarButton 
        id=
"OpenButton" 
        
text="Open" 
        
onClick="ProcessOpen" 
        
/>
    <hbj:toolbarButton 
        id=
"CloseButton" 
        
text="Close" 
        
onClick="ProcessClose" 
        
/>
    <hbj:toolbarSeparator 
        id=
"mySeparator" 
        
/>
    <hbj:toolbarInputField 
        id=
"Scale" 
        
value="100%" 
        
width="50px" 
        
/>
    <hbj:toolbarSeparator 
        id=
"mySeparator" 
        
/>
    <hbj:toolbarDropDownListBox 
        id=
"myDDL2">
        <hbj:listBoxItem 
            key=
"k1" 
            
value="Arial" 
            
/>
        <hbj:listBoxItem 
            key=
"k2" 
            
value="Times Roman" 
            
/>
        <hbj:listBoxItem 
            key=
"k3" 
            
value="Verdana" 
            
selected="true" 
            
/>
    </hbj:toolbarDropDownListBox>
  </hbj:toolbar>

 

using the classlib

    Form form = (Form)this.getForm();
    Toolbar tb = 
new Toolbar("toolbar");
    tb.setDesign(ToolbarDesign.EMPHASIZED);
    ToolbarButton openButton = tb.addToolbarButton(
"OpenButton","Open");
    openButton.setOnClick(
"ProcessOpen");
    ToolbarButton closeButton = tb.addToolbarButton(
"CloseButton","Close");
    closeButton.setOnClick(
"ProcessClose");
    tb.addToolbarSeparator();
//     Create input field
    
ToolbarInputField input = new InputField("Scale");
    input.setType(DataType.STRING);
    input.setWidth(
"50px");
    input.setValue(
"100%");
    tb.addToolbarInputField(
"Scale");

    tb.addToolbarSeparator();
//     Create dropdown list box
    
ToolbarDropdownListBox ddl = new ToolbarDropdownListBox("Fonts");
    ddl.addItem(
"k1","Arial");
    ddl.addItem(
"k2","Times Roman");
    ddl.addItem(
"k3","Verdana");
    ddl.setSelection(
"k3");
    tb.addToolbarDropdownListBox(
"Fonts");

    form.addComponent(tb);

 

Result

This graphic is explained in the accompanying text

 

End of Content Area