com.esri.arcgis.controls
Class IToolbarControlProxy

java.lang.Object
  extended by com.esri.arcgis.interop.Dispatch
      extended by com.esri.arcgis.controls.IToolbarControlProxy
All Implemented Interfaces:
IToolbarControl, Externalizable, Serializable
Direct Known Subclasses:
IToolbarControl2Proxy

public class IToolbarControlProxy
extends com.esri.arcgis.interop.Dispatch
implements IToolbarControl, Serializable

Provides access to members that control the ToolbarControl.

Superseded By

IToolbarControl2

Description

The IToolbarControl interface is a starting point for any tasks related to the ToolBarControl such as setting the general appearance, setting the buddy control, adding and removing commands, tools, toolcontrols, menus and palettes, and customizing the contents of the ToolbarControl.

Product Availability

Available with ArcGIS Engine.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.esri.arcgis.interop.Dispatch
DISPATCH_METHOD, DISPATCH_PROPERTYGET, DISPATCH_PROPERTYPUT, DISPATCH_PROPERTYPUTREF, E
 
Constructor Summary
  IToolbarControlProxy()
           
  IToolbarControlProxy(Object obj)
           
protected IToolbarControlProxy(Object obj, String iid)
           
 
Method Summary
 void aboutBox()
          Displays a dialog of information about the ToolbarControl.
 int addItem(Object item, int subType, int index, boolean beginGroup, int groupSpacing, int style)
          Adds an item to the ToolbarControl.
 void addListener(String iidStr, Object theListener, Object theSource)
           
 int addMenuItem(Object menu, int index, boolean beginGroup, int groupSpacing)
          Adds a menu item to the ToolbarControl.
 int addToolbarDef(Object toolbarDef, int startIndex, boolean group, int groupSpacing, int style)
          Appends the contents of the toolbar definition, specified by Guid or ToolbarDef, to the toolbar control.
 boolean esri_isEnabled()
          Indicates whether the ToolbarControl can respond to user generated events.
 void esri_setEnabled(boolean pbool)
          Indicates whether the ToolbarControl can respond to user generated events.
 int find(Object item)
          Returns the index of the first item containing the given command, menu or palette.
 int getAppearance()
          The appearance of the ToolbarControl.
 int getBorderStyle()
          The border style of the ToolbarControl.
 Object getBuddy()
          The object that will have its current tool managed by the toolbar.
 ICommandPool getCommandPool()
          The command pool used by the ToolbarControl to manage command objects.
 int getCount()
          The number of items on the ToolbarControl.
 ITool getCurrentTool()
          The current tool of the buddy.
 Object getCustomProperty()
          A property to associate data with a control.
 int getHWnd()
          Handle to the window associated with the ToolbarControl.
 IToolbarItem getItem(int index)
          Returns the item at the specified index from the ToolbarControl.
 int getItemAppearance()
          The appearance of the items on the ToolbarControl.
 void getItemRect(int index, int[] top, int[] left, int[] bottom, int[] right)
          Returns the dimensions of the item at the specified index.
 int getKeyIntercept()
          A property that specifies interception of key strokes that are normally handled by the container.
 Picture getMouseIcon()
          Custom mouse icon used if MousePointer is 99.
 int getMousePointer()
          The mouse pointer displayed over the ToolbarControl.
 Object getObject()
          A property that returns the underlying control.
 IOperationStack getOperationStack()
          The operation stack used for undo and redo functionality.
 int getTextAlignment()
          The caption placement for all items on the ToolbarControl.
 int getUpdateInterval()
          The frequency in millisecs that update method is called on the ToolbarControl.
 int hitTest(int x, int y, boolean nearest)
          Returns the index of the item at the specified x and y coordinates.
 boolean isCustomize()
          Indicates if the ToolbarControl is in customize mode.
 boolean isLargeIcons()
          Indicates if large icons are shown on all items on the ToolbarControl.
 boolean isMenuTracking()
          Indicates if menu tracking is enabled on the ToolbarControl.
 boolean isToolTips()
          Indicates if the items tooltips are shown.
 void moveItem(int startIndex, int finalIndex)
          Moves an item from one index to another.
 void readExternal(ObjectInput in)
           
 void remove(int index)
          Removes the item at the specified index from the ToolbarControl.
 void removeAll()
          Removes all items from the ToolbarControl.
 void removeListener(String iidStr, Object theListener)
           
 void setAppearance(int pappearance)
          The appearance of the ToolbarControl.
 void setBorderStyle(int pstyle)
          The border style of the ToolbarControl.
 void setBuddyControl(Object pToolbarBuddy)
          Sets a control to be a buddy of the toolbar, this control must support IToolbarBuddy.
 void setCommandPoolByRef(ICommandPool pVal)
          The command pool used by the ToolbarControl to manage command objects.
 void setCurrentToolByRef(ITool pVal)
          The current tool of the buddy.
 void setCustomize(boolean pVal)
          Indicates if the ToolbarControl is in customize mode.
 void setCustomProperty(Object pVal)
          A property to associate data with a control.
 void setItemAppearance(int pappearance)
          The appearance of the items on the ToolbarControl.
 void setKeyIntercept(int pVal)
          A property that specifies interception of key strokes that are normally handled by the container.
 void setLargeIcons(boolean pVal)
          Indicates if large icons are shown on all items on the ToolbarControl.
 void setMenuTracking(boolean pVal)
          Indicates if menu tracking is enabled on the ToolbarControl.
 void setMouseIconByRef(Picture ppMouseIcon)
          Custom mouse icon used if MousePointer is 99.
 void setMousePointer(int ppointer)
          The mouse pointer displayed over the ToolbarControl.
 void setOperationStackByRef(IOperationStack operationStack)
          The operation stack used for undo and redo functionality.
 void setTextAlignment(int pVal)
          The caption placement for all items on the ToolbarControl.
 void setToolTips(boolean pVal)
          Indicates if the items tooltips are shown.
 void setUpdateInterval(int pVal)
          The frequency in millisecs that update method is called on the ToolbarControl.
 void update(int index, boolean fullUpdate)
          Updates the enabled state of the specified item or all items if an index of -1 is specified.
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class com.esri.arcgis.interop.Dispatch
bindUsingMoniker, constructVtblPosTable, convertToNative, cookieForListener, createDispatch, createObjrefMonikerDisplayName, equals, getActiveObject, getActiveObject, getDefaultProperty, getDispatchIdOfName, getLastErrorCode, getMtsObjectContext, getObjRef, getPropertyByName, getPropertyByName, getVtblPos, hashCode, initDispatch, invoke, invokeMethodByName, invokeMethodByName, invokeMethodByName, invokePropertyGetByName, invokePropertyPutByName, invokePropertyPutByRefByName, isNativeMode, isObjRef, queryInterface, release, setNativeMode, setPropertyByName, toString, vtblInvoke
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IToolbarControlProxy

public IToolbarControlProxy()

IToolbarControlProxy

public IToolbarControlProxy(Object obj)
                     throws IOException
Throws:
IOException

IToolbarControlProxy

protected IToolbarControlProxy(Object obj,
                               String iid)
                        throws IOException
Throws:
IOException
Method Detail

addListener

public void addListener(String iidStr,
                        Object theListener,
                        Object theSource)
                 throws IOException
Overrides:
addListener in class com.esri.arcgis.interop.Dispatch
Throws:
IOException

removeListener

public void removeListener(String iidStr,
                           Object theListener)
                    throws IOException
Overrides:
removeListener in class com.esri.arcgis.interop.Dispatch
Throws:
IOException

setBorderStyle

public void setBorderStyle(int pstyle)
                    throws IOException,
                           AutomationException
The border style of the ToolbarControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
setBorderStyle in interface IToolbarControl
Parameters:
pstyle - A com.esri.arcgis.controls.esriControlsBorderStyle constant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getBorderStyle

public int getBorderStyle()
                   throws IOException,
                          AutomationException
The border style of the ToolbarControl.

Description

Returns or sets the border style of a ToolbarControl. By default a border is not drawn.

Product Availability

Available with ArcGIS Engine.

Specified by:
getBorderStyle in interface IToolbarControl
Returns:
A com.esri.arcgis.controls.esriControlsBorderStyle constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

esri_setEnabled

public void esri_setEnabled(boolean pbool)
                     throws IOException,
                            AutomationException
Indicates whether the ToolbarControl can respond to user generated events.

Product Availability

Available with ArcGIS Engine.

Specified by:
esri_setEnabled in interface IToolbarControl
Parameters:
pbool - The pbool (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

esri_isEnabled

public boolean esri_isEnabled()
                       throws IOException,
                              AutomationException
Indicates whether the ToolbarControl can respond to user generated events.

Product Availability

Available with ArcGIS Engine.

Specified by:
esri_isEnabled in interface IToolbarControl
Returns:
The pbool
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setAppearance

public void setAppearance(int pappearance)
                   throws IOException,
                          AutomationException
The appearance of the ToolbarControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
setAppearance in interface IToolbarControl
Parameters:
pappearance - A com.esri.arcgis.controls.esriControlsAppearance constant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getAppearance

public int getAppearance()
                  throws IOException,
                         AutomationException
The appearance of the ToolbarControl.

Description

Returns or sets the paint style of a ToolbarControl to either Flat or 3D. By default the appearance is flat.

Product Availability

Available with ArcGIS Engine.

Specified by:
getAppearance in interface IToolbarControl
Returns:
A com.esri.arcgis.controls.esriControlsAppearance constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setMousePointer

public void setMousePointer(int ppointer)
                     throws IOException,
                            AutomationException
The mouse pointer displayed over the ToolbarControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
setMousePointer in interface IToolbarControl
Parameters:
ppointer - A com.esri.arcgis.controls.esriControlsMousePointer constant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getMousePointer

public int getMousePointer()
                    throws IOException,
                           AutomationException
The mouse pointer displayed over the ToolbarControl.

Description

Use this property when you want to indicate changes in functionality as the mouse pointer passes over the ToolbarControl. The esriPointerArrowHourglass setting (11) is useful for indicating that the user should wait for a process or operation to finish.

Product Availability

Available with ArcGIS Engine.

Specified by:
getMousePointer in interface IToolbarControl
Returns:
A com.esri.arcgis.controls.esriControlsMousePointer constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setMouseIconByRef

public void setMouseIconByRef(Picture ppMouseIcon)
                       throws IOException,
                              AutomationException
Custom mouse icon used if MousePointer is 99.

Product Availability

Available with ArcGIS Engine.

Specified by:
setMouseIconByRef in interface IToolbarControl
Parameters:
ppMouseIcon - A reference to a com.esri.arcgis.support.ms.stdole.Picture (A com.esri.arcgis.support.ms.stdole.Picture COM typedef) (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getMouseIcon

public Picture getMouseIcon()
                     throws IOException,
                            AutomationException
Custom mouse icon used if MousePointer is 99.

Description

The MouseIcon property provides a custom icon that is used when the MousePointer property is set to esriPointerArrowHourglass (99).

Remarks

In most development evironments the control's property pages can be used to load either a cursor (.cur) or icon (.ico) file. A cursor contains a custom 'hotspot' location and can be any size. The 'hotspot' location for an icon file defaults to the center of the icon. This property cannot be used to load animated cursor (.ani) files.

To programatically create an object implementing IPictureDisp there is the win32 function OleLoadPicture or helper methods depending on the development environment.

Product Availability

Available with ArcGIS Engine.

Specified by:
getMouseIcon in interface IToolbarControl
Returns:
A reference to a com.esri.arcgis.support.ms.stdole.Picture (A com.esri.arcgis.support.ms.stdole.Picture COM typedef)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getHWnd

public int getHWnd()
            throws IOException,
                   AutomationException
Handle to the window associated with the ToolbarControl.

Description

The operating environment identifies each window, form and control in an application by assigning it a handle, or hWnd. Many ArcObjects methods and Windows API calls require the hWnd as an argument.

Product Availability

Available with ArcGIS Engine.

Specified by:
getHWnd in interface IToolbarControl
Returns:
The hWnd
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

aboutBox

public void aboutBox()
              throws IOException,
                     AutomationException
Displays a dialog of information about the ToolbarControl.

Description

The AboutBox method causes a modal dialog box to display on top of the ToolbarControl, containing information about the version and creation date of the ToolbarControl as well as listing relevant legal and copyright information from ESRI.

Product Availability

Available with ArcGIS Engine.

Specified by:
aboutBox in interface IToolbarControl
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addItem

public int addItem(Object item,
                   int subType,
                   int index,
                   boolean beginGroup,
                   int groupSpacing,
                   int style)
            throws IOException,
                   AutomationException
Adds an item to the ToolbarControl.

Description

Takes the specified command and creates a new item that is added to the ToolbarControl with its Command or Menu or Palette set, and returns the index of the first item added. Specifiy the command, menu or palette as either a IUid, ProgID, ICommand, IMenuDef, IToolbarMenu, IPaletteDef or IToolbarPalette. AddItem supports the following objects: ICommand, IMenuDef, IToolbarMenu, ICommandSubType, ITool, IToolControl, IPaletteDef and IToolbarPalette . Visually items are represented on the ToolbarControl as buttons, tools, menus, text boxes and combo boxes.

Supply a subType when passing an ICommandSubType. If no subType is supplied and the command is passed as a IUid or ProgID then ICommandSubType::GetCount determines the number of Item's to be added to the ToolbarControl. A subType must be supplied when passing an ICommandSubType as an ICommand, or the method will fail. By default subType is 0.

Index determines the position on the ToolbarControl that the item will be added to. By default this is -1 and represents the end of the ToolbarControl.

beginGroup determines whether a separator will appear before the item. By default beginGroup is False.

GroupSpacing determines the width in pixels of the separator.

Style determines the sytle of the item. By default Style is set to esriCommandStyleIconOnly.

Remarks

AddItem checks to see if the supplied command already exists in the CommandPool used by the ToolbarControl. If the command does not already exist, it is created and added to the CommandPool with a ICommandPool::UsageCount of 1, and is set as the IToolbarItem::Command. If the command already exists in the CommandPool, then the command instance is reused, its ICommandPool::UsageCount is incremented by 1 and the command is set as the IToolbarItem::Command. The ICommand::OnCreate method will be called the first time a command is added to the CommandPool.

Where possible always supply commands, menus and palettes as either Uid objects or ProgID's. Only supply commands as ICommand, IMenuDef or IPaletteDef objects when a IUid or ProgID does not exist, and the class is compiled as part of the same project using the ToolbarControl. Passing a command menu or palette as an ICommand, IMenuDef or IPaletteDef object has the following limitation: Multiple instances of the same command can be added to the CommandPool, and each IToolbarItem::Command will point to a different command object. For example, setting a command implementing the ITool interface to be the CurrentTool would result in only one item appearing visually pressed on the on the ToolbarControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
addItem in interface IToolbarControl
Parameters:
item - A Variant (in)
subType - The subType (in, optional, pass 0 if not required)
index - The index (in, optional, pass -1 if not required)
beginGroup - The beginGroup (in, optional, pass false if not required)
groupSpacing - The groupSpacing (in, optional, pass 0 if not required)
style - A com.esri.arcgis.systemUI.esriCommandStyles constant (in, optional, pass 1 if not required)
Returns:
The itemIndex
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

remove

public void remove(int index)
            throws IOException,
                   AutomationException
Removes the item at the specified index from the ToolbarControl.

Description

Removes the item at the specified index from the ToolBarControl. The item at the beginning of the collection to the left of the ToolBarControl has an index of 0.

Remarks

The Remove method will automatically find the IToolbarItem::Command in the CommandPool and decrement the ICommandPool::UsageCount by 1. If the ICommandPool::UsageCount reaches 0 the command will be released from the CommandPool.

Product Availability

Available with ArcGIS Engine.

Specified by:
remove in interface IToolbarControl
Parameters:
index - The index (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

removeAll

public void removeAll()
               throws IOException,
                      AutomationException
Removes all items from the ToolbarControl.

Description

This method removes all item's from the ToolBarControl.

Remarks

For each item removed the RemoveAll method will automatically find the IToolbarItem::Command in the CommandPool and decrement the ICommandPool::UsageCount by 1. If the ICommandPool::UsageCount reaches 0 the command will be released from the CommandPool .

Product Availability

Available with ArcGIS Engine.

Specified by:
removeAll in interface IToolbarControl
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getItem

public IToolbarItem getItem(int index)
                     throws IOException,
                            AutomationException
Returns the item at the specified index from the ToolbarControl.

Description

The property is used to access a particular item on the ToolBarControl. The item at the beginning of the collection to the left of the ToolBarControl has an index of 0. Visually items are represented on the ToolbarControl as buttons, tools, menus, text boxes and combo boxes.

Remarks

To loop through a ToolBarControl's item collection use the GetItem property in conjunction with the Count property.

Example:

 

Product Availability

Available with ArcGIS Engine.

Specified by:
getItem in interface IToolbarControl
Parameters:
index - The index (in)
Returns:
A reference to a com.esri.arcgis.controls.IToolbarItem
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getCount

public int getCount()
             throws IOException,
                    AutomationException
The number of items on the ToolbarControl.

Description

Returns the number of items on the ToolbarControl.

Example:

 

Product Availability

Available with ArcGIS Engine.

Specified by:
getCount in interface IToolbarControl
Returns:
The count
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

update

public void update(int index,
                   boolean fullUpdate)
            throws IOException,
                   AutomationException
Updates the enabled state of the specified item or all items if an index of -1 is specified. Specify fullUpdate to update the group, group spacing, style and bitmap properties.

Description

The primary job of the Update method is to ensure that each item on the ToolbarControl is synchronised with the ICommand properties of the IToolbarItem::Command.

By default the index argument is -1, and each item on the ToolbarControl is updated. To update a specific item, specifiy its index. The item at the beginning of the collection to the left of the ToolbarControl has an index of 0.

By default the fullUpdate argument is false, and each item is updated to reflect its ICommand::Enabled, ICommand::Caption and ICommand::Checked properties. Pass true to Update to additionally update the following properties: ICommand::Bitmap, IToolbarItem::Style, IToolbarItem::Group and IToolbarItem::GroupSpacing properties.

By default the Update method is called automatically on a regular interval specified by the UpdateInterval to ensure that the ToolbarControl item's reflect the current application state. This updates all items, but with a fullUpdate argument set to false.

Remarks

The Update method checks each commands ICommandPool::Created property. If the command has not been created the ICommandPoolEdit::Hook property is passed into the ICommand::OnCreate method. The hook it typically the ToolbarControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
update in interface IToolbarControl
Parameters:
index - The index (in, optional, pass -1 if not required)
fullUpdate - The fullUpdate (in, optional, pass false if not required)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getBuddy

public Object getBuddy()
                throws IOException,
                       AutomationException
The object that will have its current tool managed by the toolbar.

Description

The Buddy returns the object implementing IToolbarBuddy that was passed to the SetBuddyControl method. The Buddy is responsible for handling the CurrentTool.

The SetBuddyControl method will remove any wrapper object that a development environment has added to the control passed to it. As such, the object passed into the SetBuddyControl method may be different from the object returned by the Buddy.

Remarks

When an application is first started the Buddy may return Nothing until the first Update has happened. By default the Update method will be first called internally after an UpdateInterval (the default is 500 milliseconds). To avoid this delay call Update within the form load event.

Product Availability

Available with ArcGIS Engine.

Specified by:
getBuddy in interface IToolbarControl
Returns:
A reference to another Automation Object (IDispatch)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getCurrentTool

public ITool getCurrentTool()
                     throws IOException,
                            AutomationException
The current tool of the buddy.

Description

This is a shortcut to the CurrentTool of the Buddy. The Buddy implements the IToolbarBuddy interface that has a CurrentTool property. If no Buddy is set the CurrentTool returns Nothing.

On a ToolbarControl there is only ever one CurrentTool, and this is the item that appears 'pushed in'. If another tool is selected it becomes the new CurrentTool and the previous tool is deactivated.

If multiple ToolbarControls share the same CommandPool and have the same Buddy the CurrentTool is synchronised through the Buddy so only one item on all the ToolbarControl's will be the CurrentTool.

Remarks

Always check that the Buddy has been set, before setting the CurrentTool or the method will fail.

When the CurrentTool is set the following events occur:

  1. The ITool::Deactivate event is triggered on the 'old' CurrentTool if one was set. If this event returns false a trappable error ocurrs. If this event returns true the 'old' CurrentTool is removed and replaced.
  2. The ICommand::OnClick event is triggered on the 'new' CurrentTool and its cursor is picked up.

Within an ITool implementation it is recommended that the ITool::Deactivate event returns true. This allows a 'new' CurrentTool to be set, and allows the release of the CurrentTool when an application is shutting down.

Product Availability

Available with ArcGIS Engine.

Specified by:
getCurrentTool in interface IToolbarControl
Returns:
A reference to a com.esri.arcgis.systemUI.ITool
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setCurrentToolByRef

public void setCurrentToolByRef(ITool pVal)
                         throws IOException,
                                AutomationException
The current tool of the buddy.

Product Availability

Available with ArcGIS Engine.

Specified by:
setCurrentToolByRef in interface IToolbarControl
Parameters:
pVal - A reference to a com.esri.arcgis.systemUI.ITool (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isToolTips

public boolean isToolTips()
                   throws IOException,
                          AutomationException
Indicates if the items tooltips are shown.

Description

Determines whether each item on the ToolbarControl will display the ICommand::Tooltip property when the mouse cursor is held over the item. This property is true by default.

Product Availability

Available with ArcGIS Engine.

Specified by:
isToolTips in interface IToolbarControl
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setToolTips

public void setToolTips(boolean pVal)
                 throws IOException,
                        AutomationException
Indicates if the items tooltips are shown.

Product Availability

Available with ArcGIS Engine.

Specified by:
setToolTips in interface IToolbarControl
Parameters:
pVal - The pVal (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getItemAppearance

public int getItemAppearance()
                      throws IOException,
                             AutomationException
The appearance of the items on the ToolbarControl.

Description

Returns or sets the paint style of each Item on the ToolbarControl to either Flat or 3D. By default the item appearance is flat.

Product Availability

Available with ArcGIS Engine.

Specified by:
getItemAppearance in interface IToolbarControl
Returns:
A com.esri.arcgis.controls.esriControlsAppearance constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setItemAppearance

public void setItemAppearance(int pappearance)
                       throws IOException,
                              AutomationException
The appearance of the items on the ToolbarControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
setItemAppearance in interface IToolbarControl
Parameters:
pappearance - A com.esri.arcgis.controls.esriControlsAppearance constant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getUpdateInterval

public int getUpdateInterval()
                      throws IOException,
                             AutomationException
The frequency in millisecs that update method is called on the ToolbarControl.

Description

Specifies the frequency the ToolbarControl automatically calls the Update method (without a full update). Setting the UpdateInterval to 0 will stop the Update method been called automatically. By default the UpdateInterval is set to 500 milliseconds.

Remarks

Be aware that setting a small UpdateInterval may cause memory usage to increase and the system to become busy doing continual updates.

Product Availability

Available with ArcGIS Engine.

Specified by:
getUpdateInterval in interface IToolbarControl
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setUpdateInterval

public void setUpdateInterval(int pVal)
                       throws IOException,
                              AutomationException
The frequency in millisecs that update method is called on the ToolbarControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
setUpdateInterval in interface IToolbarControl
Parameters:
pVal - The pVal (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

find

public int find(Object item)
         throws IOException,
                AutomationException
Returns the index of the first item containing the given command, menu or palette. Returns -1 if the command is not found.

Description

Returns the index of the first item on the ToolbarControl using the specified IUid , ProgID, ICommand, IMenuDef or IPaletteDef. If the specified command or menu cannot be found -1 is returned.

Remarks

To find an item using a Command implementing ICommandSubType pass a UID with its SubType property set.

Product Availability

Available with ArcGIS Engine.

Specified by:
find in interface IToolbarControl
Parameters:
item - A Variant (in)
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getCommandPool

public ICommandPool getCommandPool()
                            throws IOException,
                                   AutomationException
The command pool used by the ToolbarControl to manage command objects. The command pool object maybe shared with other ToolbarControls and ToolbarMenus.

Description

The CommandPool manages the collection of commands used by the ToolbarControl. The AddItem, AddToolbarDef, Remove and RemoveAll methods all use the CommandPool.

Care must be taken by developers when using the CommandPool to ensure that the ICommandPool::UsageCount of any commands in the collection stay synchronised with the number of item's using the command as the IToolbarItem::Command.

Note that if a new CommandPool is set commands are copied from the original CommandPool into the new one. If the same command exists in the original CommadPool and the new CommandPool, the command in the new CommandPool is used.

Product Availability

Available with ArcGIS Engine.

Specified by:
getCommandPool in interface IToolbarControl
Returns:
A reference to a com.esri.arcgis.controls.ICommandPool
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setCommandPoolByRef

public void setCommandPoolByRef(ICommandPool pVal)
                         throws IOException,
                                AutomationException
The command pool used by the ToolbarControl to manage command objects. The command pool object maybe shared with other ToolbarControls and ToolbarMenus.

Product Availability

Available with ArcGIS Engine.

Specified by:
setCommandPoolByRef in interface IToolbarControl
Parameters:
pVal - A reference to a com.esri.arcgis.controls.ICommandPool (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addToolbarDef

public int addToolbarDef(Object toolbarDef,
                         int startIndex,
                         boolean group,
                         int groupSpacing,
                         int style)
                  throws IOException,
                         AutomationException
Appends the contents of the toolbar definition, specified by Guid or ToolbarDef, to the toolbar control.

Description

Takes the specified toolbar definition and for each command specified an item is created and added to the ToolbarControl with an associated IToolbarItem::Command set. Specifiy the toolbar definition as either a IUid, ProgID, or IToolBarDef .

startIndex determines the position on the ToolbarControl each item will be added to. By default this is -1 and represents the end of the ToolbarControl.

Group determines whether separators will appear before the first and after the last item defined by the IToolBarDef . By default Group is False. Note this will override any IItemDef::Group property set in the IToolBarDef.

GroupSpacing determines the width of any separators, and applies to all item's defined by the IToolBarDef .

Style applies to all item's defined by the IToolBarDef. By default Style is set to esriCommandStyleIconOnly.

Where possible always supply toolbars as either Uid objects or ProgID's. Only supply toolbars as IToolBarDef objects when a IUid or ProgID does not exist, and the class is compiled as part of the same project using the ToolbarControl.

Remarks

For each command specified by the IToolBarDef, AddToolbarDef calls the AddItem method which checks to see if the supplied command already exists in the CommandPool. If the command does not already exist, it is added to the CommandPool with a ICommandPool::UsageCount of 1, and is set as the IToolbarItem::Command. If the command does already exist in the CommandPool its ICommandPool::UsageCount increments by 1 and the command is set as the IToolbarItem::Command. The ICommand::OnCreate method will only be called the first time a command is added to the CommandPool.

Product Availability

Available with ArcGIS Engine.

Specified by:
addToolbarDef in interface IToolbarControl
Parameters:
toolbarDef - A Variant (in)
startIndex - The startIndex (in, optional, pass -1 if not required)
group - The group (in, optional, pass false if not required)
groupSpacing - The groupSpacing (in, optional, pass 4 if not required)
style - A com.esri.arcgis.systemUI.esriCommandStyles constant (in, optional, pass 1 if not required)
Returns:
The count
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getTextAlignment

public int getTextAlignment()
                     throws IOException,
                            AutomationException
The caption placement for all items on the ToolbarControl.

Description

Returns or sets whether each item on the ToolBarControl will display the ICommand::Caption property aligned to the right or to the bottom of the item. By default the captions will be aligned to the right of items.

Remarks

Captions are only displayed for those items with IToolbarItem::Style set to esriCommandStyleTextOnly or esriCommandStyleIconAndText.

Product Availability

Available with ArcGIS Engine.

Specified by:
getTextAlignment in interface IToolbarControl
Returns:
A com.esri.arcgis.controls.esriToolbarTextAlignment constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setTextAlignment

public void setTextAlignment(int pVal)
                      throws IOException,
                             AutomationException
The caption placement for all items on the ToolbarControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
setTextAlignment in interface IToolbarControl
Parameters:
pVal - A com.esri.arcgis.controls.esriToolbarTextAlignment constant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isLargeIcons

public boolean isLargeIcons()
                     throws IOException,
                            AutomationException
Indicates if large icons are shown on all items on the ToolbarControl.

Description

Determines whether each item on the ToolBarControl will display the ICommand::Bitmap property stretched to 32 x 32 pixels. This property is false by default and bitmaps are stretched to 16 x 16 pixels.

Remarks

When the IconSize property to set to a size => 32, LargeIcons returns true.

Product Availability

Available with ArcGIS Engine.

Specified by:
isLargeIcons in interface IToolbarControl
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setLargeIcons

public void setLargeIcons(boolean pVal)
                   throws IOException,
                          AutomationException
Indicates if large icons are shown on all items on the ToolbarControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
setLargeIcons in interface IToolbarControl
Parameters:
pVal - The pVal (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isCustomize

public boolean isCustomize()
                    throws IOException,
                           AutomationException
Indicates if the ToolbarControl is in customize mode.

Description

Use this property to determine whether the ToolbarControl is in customize mode at run time. This property is false by default. The behaviour of ToolbarControl changes when in customize mode.

Use the left mouse button to select an item on the ToolbarControl. Either drag the selected item to a new position on the ToolbarControl as indicated by the black verticle line, or drag and drop the item off the ToolbarControl to remove it.

Use the right mouse button to select an item and display the customize menu. Use the customize menu to either delete the item or set its Style, Group or GroupSpacing properties.

If the CustomizeDialog is displayed on the screen whilst the ToolbarControl is in customize mode, new items can be added to the ToolbarControl by either double clicking on an item in the CustomizeDialog or by dragging and dropping an item from the CustomizeDialog to the ToolbarControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
isCustomize in interface IToolbarControl
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setCustomize

public void setCustomize(boolean pVal)
                  throws IOException,
                         AutomationException
Indicates if the ToolbarControl is in customize mode.

Product Availability

Available with ArcGIS Engine.

Specified by:
setCustomize in interface IToolbarControl
Parameters:
pVal - The pVal (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

moveItem

public void moveItem(int startIndex,
                     int finalIndex)
              throws IOException,
                     AutomationException
Moves an item from one index to another.

Description

Moves the item at the specified startIndex, to the position at the specified finalIndex. If no finalIndex is supplied the item is moved to the end of the ToolbarControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
moveItem in interface IToolbarControl
Parameters:
startIndex - The startIndex (in)
finalIndex - The finalIndex (in, optional, pass -1 if not required)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

hitTest

public int hitTest(int x,
                   int y,
                   boolean nearest)
            throws IOException,
                   AutomationException
Returns the index of the item at the specified x and y coordinates.

Description

Returns the index of the item at the specified x and y coordinates (in pixels). If no item is found, returns -1.

nearest specifies whether the index of the item nearest to the specified x and y coordinates is returned. By default nearest is false.

Product Availability

Available with ArcGIS Engine.

Specified by:
hitTest in interface IToolbarControl
Parameters:
x - The x (in)
y - The y (in)
nearest - The nearest (in, optional, pass false if not required)
Returns:
The index
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getItemRect

public void getItemRect(int index,
                        int[] top,
                        int[] left,
                        int[] bottom,
                        int[] right)
                 throws IOException,
                        AutomationException
Returns the dimensions of the item at the specified index.

Description

Returns the dimensions in pixels of the item at the specified index on the ToolbarControl. An item's rectangle refers to the area on the ToolbarControl occupied by the button, text box or combo box. These rectangles are adjacent. For example, if the first item had a left value of 2, and a right value of 26, the second item would have a left value of 26.

Product Availability

Available with ArcGIS Engine.

Specified by:
getItemRect in interface IToolbarControl
Parameters:
index - The index (in)
top - The top (in/out: use single element array)
left - The left (in/out: use single element array)
bottom - The bottom (in/out: use single element array)
right - The right (in/out: use single element array)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getOperationStack

public IOperationStack getOperationStack()
                                  throws IOException,
                                         AutomationException
The operation stack used for undo and redo functionality. If present commands can use it to store operations.

Description

The OperationStack used to manage undo and redo functionality. Operations are added to the operation stack by each item's Command, so that the operation can be rolled forward and then rolled back as desired. For example, when a graphic element is moved, the operation can be undone moving the graphic back to its original location.

By default the OperationStack will return Nothing. Typically, a developer creates a ControlsOperationStack and sets it into the ToolbarControl. 'Undo' and 'Redo' commands can be added to the ToolbarControl to step through the OperationStack.

Whether or not a command makes use of an OperationStack depends upon its implementation. For example, a command to nudge the position of a graphic element will create an object implementing IOperation and add it to the OperationStack using IOperationStack::Do.

Note, that commands that change the IActiveView::Extent do not need to implement an IOperation object, as the extent is automatically stored in the IActiveView::ExtentStack.

Product Availability

Available with ArcGIS Engine.

Specified by:
getOperationStack in interface IToolbarControl
Returns:
A reference to a com.esri.arcgis.systemUI.IOperationStack
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setOperationStackByRef

public void setOperationStackByRef(IOperationStack operationStack)
                            throws IOException,
                                   AutomationException
The operation stack used for undo and redo functionality. If present commands can use it to store operations.

Product Availability

Available with ArcGIS Engine.

Specified by:
setOperationStackByRef in interface IToolbarControl
Parameters:
operationStack - A reference to a com.esri.arcgis.systemUI.IOperationStack (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getCustomProperty

public Object getCustomProperty()
                         throws IOException,
                                AutomationException
A property to associate data with a control.

Description

Use the CustomProperty to associate any useful data with the ToolbarControl. This is similar to a 'Tag' property, and can be use to store strings, numbers and objects.

Product Availability

Available with ArcGIS Engine.

Specified by:
getCustomProperty in interface IToolbarControl
Returns:
A Variant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setCustomProperty

public void setCustomProperty(Object pVal)
                       throws IOException,
                              AutomationException
A property to associate data with a control.

Product Availability

Available with ArcGIS Engine.

Specified by:
setCustomProperty in interface IToolbarControl
Parameters:
pVal - A Variant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setBuddyControl

public void setBuddyControl(Object pToolbarBuddy)
                     throws IOException,
                            AutomationException
Sets a control to be a buddy of the toolbar, this control must support IToolbarBuddy.

Description

Pass the SetBuddyControl method a MapControl, PageLayoutControl, SceneControl, GlobeControl or object implementing IToolbarBuddy. To clear the Buddy set the property to Nothing.

The ToolbarControl is passed as the hook parameter to the ICommand::OnCreate method of each item's command on the ToolbarControl. Each command will typically check the type of Buddy that has been set before becoming enabled. For example, a 'map zoom in' tool will only become enabled if the Buddy is a control that has a Map object ie. a MapControl or PageLayoutControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
setBuddyControl in interface IToolbarControl
Parameters:
pToolbarBuddy - A reference to another Automation Object (IDispatch) (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isMenuTracking

public boolean isMenuTracking()
                       throws IOException,
                              AutomationException
Indicates if menu tracking is enabled on the ToolbarControl.

Description

Indicates whether a menu or palette on the ToolbarControl will display automatically as the user moves the mouse over it, or whether the user must click on the arrow to the right of the menu or palette to display it.

An application's main menu toolbar would typically contain menu only items such as File, Edit, View and Help and would typically have MenuTracking enabled.

Product Availability

Available with ArcGIS Engine.

Specified by:
isMenuTracking in interface IToolbarControl
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setMenuTracking

public void setMenuTracking(boolean pVal)
                     throws IOException,
                            AutomationException
Indicates if menu tracking is enabled on the ToolbarControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
setMenuTracking in interface IToolbarControl
Parameters:
pVal - The pVal (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addMenuItem

public int addMenuItem(Object menu,
                       int index,
                       boolean beginGroup,
                       int groupSpacing)
                throws IOException,
                       AutomationException
Adds a menu item to the ToolbarControl.

Description

Takes the specified menu and creates a new item that is added to the ToolbarControl and returns the index of the menu item added. This is really a shortcut to AddItem.

Specifiy the menu as either a IUID , ProgID, IMenuDef or IToolbarMenu.

If AddIMenuItem is passed an IMenuDef, the menu definition is is used to build a new ToolbarMenu, and the IToolbarMenu::CommandPool is set to the IToolbarControl::CommandPool. If AddMenuItem is passed an IToolbarMenu a new ToolbarItem is created and the IToolbarItem::Menu is set to the IToolbarMenu.

index determines the position on the ToolbarControl that the Item will be added to. By default this is -1 and represents the end of the ToolbarControl.

beginGroup determines whether a separator will appear before the Item. By default beginGroup is False.

GroupSpacing determines the width in pixels of the separator.

Remarks

AddItem checks to see if each command in the menu already exists in the CommandPool used by the ToolbarControl. If the command does not already exist, it is created and added to the CommandPool with a ICommandPool::UsageCount of 1. If the command already exists in the CommandPool its ICommandPool::UsageCount is incremented by 1. The ICommand::OnCreate method will be called the first time a command is added to the CommandPool.

Where possible always supply menus as either Uid objects or ProgID's. Only supply menu as IMenuDef objects when a IUid or ProgID does not exist, and the class is compiled as part of the same project using the ToolbarControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
addMenuItem in interface IToolbarControl
Parameters:
menu - A Variant (in)
index - The index (in, optional, pass -1 if not required)
beginGroup - The beginGroup (in, optional, pass false if not required)
groupSpacing - The groupSpacing (in, optional, pass 4 if not required)
Returns:
The itemIndex
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getObject

public Object getObject()
                 throws IOException,
                        AutomationException
A property that returns the underlying control. This can be used when the control is inside a wrapper object that has been added by a development environment.

Description

In some development environments it is not possible to query interface directly on the control to other COM interfaces, beacuse the control is contained within a wrapper object. To get the real control use the Object property.

Product Availability

Available with ArcGIS Engine.

Specified by:
getObject in interface IToolbarControl
Returns:
A reference to another Automation Object (IDispatch)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getKeyIntercept

public int getKeyIntercept()
                    throws IOException,
                           AutomationException
A property that specifies interception of key strokes that are normally handled by the container. When intercepted the OnKeyDown and OnKeyUp events will be called. This value can be a combined bit mask of esriKeyIntercept enum values.

Description

Returns or sets keys on the keyboard that will be intercepted by the ToolbarControl, triggering the OnKeyDown and OnKeyUp events when pressed. These keys are often hidden from the ToolbarControl by the development environment container. By default the KeyIntercept is set to esriKeyInterceptNone.

Many development environment containers use the up, down, left and right arrow keys to change control focus on a form. These keys can also be useful for navigating around the display. To intercept the arrow keys and the Tab key combine the enum values using a logical OR operation (esriKeyInterceptArrowKeys OR esriKeyInterceptTabKey, which is 1 OR 4 = 5).

Product Availability

Available with ArcGIS Engine.

Specified by:
getKeyIntercept in interface IToolbarControl
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setKeyIntercept

public void setKeyIntercept(int pVal)
                     throws IOException,
                            AutomationException
A property that specifies interception of key strokes that are normally handled by the container. When intercepted the OnKeyDown and OnKeyUp events will be called. This value can be a combined bit mask of esriKeyIntercept enum values.

Product Availability

Available with ArcGIS Engine.

Specified by:
setKeyIntercept in interface IToolbarControl
Parameters:
pVal - The pVal (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class com.esri.arcgis.interop.Dispatch
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class com.esri.arcgis.interop.Dispatch
Throws:
IOException
ClassNotFoundException