hitTest
hitTest は「元に戻す」が不可能、「照会」が不可能、「編集」が不可能です。
hitTest コマンドは、指定したコントロール内のポイントをヒット テストし、ポイントの下にある項目のリストを返します。ポイントは左上隅を原点(0,0)とし、ピクセルで指定されます。この位置は、ドロップ コールバックの座標と互換性があります。返される項目のタイプは、特定のコントロールに依存します。現在、ヒット テストはすべてのコントロールによってサポートされていません。| string[] | ヒットしたポイントの下の項目 |
// Let's say that you have the name of a model editor that was
// created elsewhere.
//
string $editor = "MyModelEditor";
//
// Attach a drop callback to this model editor.
//
string $control = `editor -query -control $editor`;
if (($control != "") && `control -exists $control`)
{
control -edit -dropCallback ("myModelEditorDropCallback") $control;
}
//
// Here's your drop callback:
//
global proc myModelEditorDropCallback(
string $dragControl,
string $dropControl,
string $msgs[],
int $x,
int $y,
int $type)
{
// Inside the callback we can hit-test the (x,y) drop-point
// against the control. This will return a list of DAG objects
// underneath the drop-point.
//
string $objects[] = hitTest($dropControl, $x, $y);
if (size($objects) > 0)
{
// The hit-test returned something. You can now do something
// with these objects.
}
}