|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.esri.arcgis.interop.Dispatch com.esri.arcgis.systemUI.IToolControlProxy
public class IToolControlProxy
Provides access to members that define a toolcontrol.
A ToolControl is a Command that acts like a combobox or editbox. Comboboxes let you choose an option from a drop-down list. For example, in ArcMap, you can choose which layer(s) you are selecting features from when working with a map. Editboxes are editable textboxes where you can type in text.
When implementing IToolControl to create a custom tool, use the hWnd property to pass window handle of your control to the application.
For example, if you want your ToolControl to be a simple ComboBox control, put a ComboBox control on a form and then pass the hWnd of the ComboBox control to the ToolControl. If you want your ToolControl to be more complex such as a ComboBox with a label, you can put the ComboBox and Label in a Frame control or PictureBox control, and then pass the hWnd of the Frame or PictureBox to the ToolControl.
Only one instance of a ToolControl can exist within an application framework at any given time. This is because the hWnd property is passed as window handle to the control. To prevent a user from dragging two instances of a ToolControl into an application framework set the ICommand::Category property to an empty string. This will prevent the ToolControl from appearing in the customize dialog.
There is a conflict between ToolControl and MessageBox in .NET. The problem appears when you make the ToolControl the parent of the MessageBox. If you make the application itself the parent of the MessageBox the problem goes away.
Use the following code as a workaround for this issue (C#):
[ DllImport( "User32.dll", EntryPoint="MessageBox", CharSet=CharSet.Auto )]
public static extern int MsgBox( int hWnd, String text, String caption, uint type );
and then:
MsgBox(m_app.hWnd, "Test box", "", 0);
where m_app is the member variable for the current Application.
The IToolControl interface is implemented by Command objects that act as combobox controls, editbox controls, or other types of controls that can be added to a toolbar. A Command that implements IToolControl passes its window handle to the application. To create a custom ToolControl you would implement both the ICommand and IToolControl interfaces in your class code.
ICommand
,
Serialized FormField Summary | |
---|---|
boolean |
noncastable
|
Fields inherited from class com.esri.arcgis.interop.Dispatch |
---|
DISPATCH_METHOD, DISPATCH_PROPERTYGET, DISPATCH_PROPERTYPUT, DISPATCH_PROPERTYPUTREF, objRef |
Constructor Summary | |
---|---|
|
IToolControlProxy()
|
|
IToolControlProxy(Object obj)
|
protected |
IToolControlProxy(Object obj,
String iid)
|
Method Summary | |
---|---|
void |
addListener(String iidStr,
Object theListener,
Object theSource)
|
int |
getHWnd()
The handle of the control. |
boolean |
onDrop(int barType)
Indicates if the drag-drop operation is valid. |
void |
onFocus(ICompletionNotify complete)
Occurs when the control gains focus. |
void |
removeListener(String iidStr,
Object theListener)
|
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, optimizedVtblInvoke, queryInterface, readExternal, release, setNativeMode, setPropertyByName, toString, vtblInvoke, writeExternal |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public boolean noncastable
Constructor Detail |
---|
public IToolControlProxy()
public IToolControlProxy(Object obj) throws IOException
IOException
protected IToolControlProxy(Object obj, String iid) throws IOException
IOException
Method Detail |
---|
public void addListener(String iidStr, Object theListener, Object theSource) throws IOException
addListener
in class com.esri.arcgis.interop.Dispatch
IOException
public void removeListener(String iidStr, Object theListener) throws IOException
removeListener
in class com.esri.arcgis.interop.Dispatch
IOException
public int getHWnd() throws IOException, AutomationException
When implementing IToolControl to create a custom tool, use the hWnd property to pass window handle of the control to the application.
For example, if you want your ToolControl to be a simple ComboBox control, put a ComboBox control on a form and then pass the hWnd of the ComboBox control to the ToolControl. If you want you ToolControl to be more complex such as a ComboBox with a label, you can put the ComboBox and Label in a Frame control or PictureBox control, and then pass the hWnd of the Frame or PictureBox to the ToolControl.
Only one instance of a ToolControl can exist within an application framework at any give time. This
is because the hWnd property is passed a window handle to the control. To prevent a user from dragging two instances of a ToolControl into an application framework set the ICommand::Category property to an empty string. This will prevent the ToolControl from appearing in the customzie dialog.
getHWnd
in interface IToolControl
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void onFocus(ICompletionNotify complete) throws IOException, AutomationException
complete is a reference to a ICompletionNotify object. The ToolControl object uses this complete object to indicate when it's finished.
When the ToolControl object gains focus, an ICompletionNotify object is passed to the ToolControl as the complete parameter in the OnFocus method. In your code in the OnFocus method, you would set a variable to the complete object.
The ToolControl needs to call the ICompletionNotify::SetComplete method when it's finished to let the application know that the control should lose focus.
onFocus
in interface IToolControl
complete
- A reference to a com.esri.arcgis.systemUI.ICompletionNotify (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.ICompletionNotify
public boolean onDrop(int barType) throws IOException, AutomationException
barType specifies which type of commandbar on which this
ToolControl can be dropped. Use one of the esriCmdBarType
constants.
In most cases, a ToolControl should only be used on a toolbar.
onDrop
in interface IToolControl
barType
- A com.esri.arcgis.systemUI.esriCmdBarType constant (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.esriCmdBarType
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |