API version 1
- ‐
RW
integer
dragStyle¶
アイテムのドラッグ方法を指定します。
アイテムをドラッグ&ドロップするには、dragStyleプロパティとacceptDropプロパティを設定し、onDroppedイベントハンドラにドロップ時の処理を記述します。
初期値はDRAG_STDです。
関連項目
acceptDropプロパティ
Droppedイベント
定数一覧
------------------------------------------------------------
定数値 |
説明 |
---|---|
DRAG_STD |
0:アイコンは固定されドラッグ移動することはできません。 |
DRAG_MOVE |
1:アイコンをドラッグ移動することができます。 |
使用例
CRSダウンロード
ダウンロード(IconView_icon11.png)
ダウンロード(IconView_icon12.png)
ダウンロード(IconView_icon13.png)
ダウンロード(IconView_icon21.png)
ダウンロード(IconView_icon22.png)
ダウンロード(IconView_icon23.png)
Form IconView_dragStyle {
x = 0;
y = 0;
width = 800;
height = 600;
IconView iconView1 {
x = 8;
y = 8;
width = 316;
height = 480;
# アイテムをドラッグできるようにします
dragStyle = DRAG_MOVE;
# IconViewItem のドロップを許可します
acceptDrop = DisplayObject.DROP_OBJECT + DisplayObject.DROP_MOVEMODE + DisplayObject.DROP_COPYMODE;
IconViewItem items[3] {
var ic1 = new Image();
ic1.loadImage("IconView_icon11.png");
this[0].title = "foo1";
this[0].icon = ic1;
var ic2 = new Image();
ic2.loadImage("IconView_icon12.png");
this[1].title = "foo2";
this[1].icon = ic2;
var ic3 = new Image();
ic3.loadImage("IconView_icon13.png");
this[2].title = "foo3";
this[2].icon = ic3;
};
function onDropped(e) {
^.processDropped(e, this);
}
}
IconView iconView2 {
x = 332;
y = 8;
width = 316;
height = 480;
# アイテムをドラッグできるようにします
dragStyle = DRAG_MOVE;
# IconViewItem のドロップを許可します
acceptDrop = DisplayObject.DROP_OBJECT + DisplayObject.DROP_MOVEMODE + DisplayObject.DROP_COPYMODE;
IconViewItem items[3] {
var ic1 = new Image();
ic1.loadImage("IconView_icon21.png");
this[0].title = "bar1";
this[0].icon = ic1;
var ic2 = new Image();
ic2.loadImage("IconView_icon22.png");
this[1].title = "bar2";
this[1].icon = ic2;
var ic3 = new Image();
ic3.loadImage("IconView_icon23.png");
this[2].title = "bar3";
this[2].icon = ic3;
};
function onDropped(e) {
^.processDropped(e, this);
}
}
function processDropped(e, iconViewDropped) {
var items = e.data;
if (!(items instanceof Array && items.length > 0 && items[0] instanceof IconViewItem)) {
print("IconViewItem の配列ではないオブジェクトがドロップされました");
return;
}
insertIconViewItemToIconView(items, e.dropitem, iconViewDropped);
if (e.mode == DisplayObject.DROP_MOVEMODE) {
print("DROP_MOVEMODE のため元の IconView 側の IconViewItem は削除されます");
for (var indexItem = 0; indexItem < items.length; indexItem ++) {
print(items[indexItem].owner.name + "の IconViewItem を削除します");
items[indexItem].delete();
}
}
}
function insertIconViewItemToIconView(items, itemAt, iconViewDropped)
{
var indexAt = -1;
if (itemAt != null) {
indexAt = itemAt.index;
iconViewDropped.items[indexAt].insert(items.length);
} else {
indexAt = iconViewDropped.items.length;
iconViewDropped.items.insert(items.length);
}
for (var indexItem = 0; indexItem < items.length; indexItem ++) {
var src = items[indexItem];
var dst = iconViewDropped.items[indexAt + indexItem];
dst.value = src.value;
dst.icon = src.icon;
dst.title = src.title;
dst.toolTip = src.toolTip;
dst.checked = src.checked;
dst.selected = src.selected;
}
}
}