Export (0) Print
Expand All

System.Shell.itemFromFileDrop method

[ The Windows Gadget Platform/Sidebar is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. ]

Retrieves an System.Shell.Item from the Items collection that represents the object(s) dropped on a gadget during a drag-and-drop operation (copying or moving).

Syntax


retVal = System.Shell.itemFromFileDrop(
  oEvent,
  intIndex
)

Parameters

oEvent [in]

Object that specifies the event.dataTransfer object.

intIndex [in]

Integer that specifies the index of the System.Shell.Item of interest in the Items collection.

Return value

System.Shell.Item object that represents the specified item, or null if the item cannot be determined.

Remarks

To enable listening for the drag and drop event, both ondragenter and ondragover events must be disabled in the <body> tag of the gadget HTML file (see example).

Examples

The following example demonstrates how to display the names of files dropped on the gadget.


<!-- Gadget HTML file. -->
<body onload="Init();" 
ondragenter="event.returnValue = false"
ondragover="event.returnValue = false"
ondrop="GetItemFromDrop()">
    <div id="gadgetContent">
        <span id="spFeedback">Nothing to report.</span>
    </div>
</body>
</html>

<!-- Gadget script file. -->
// --------------------------------------------------------------------
// Display the names of objects dropped on the gadget.
// --------------------------------------------------------------------
function GetItemFromDrop()
{
    spFeedback.innerHTML = "File(s) dropped.<br/>";
    var intIndex = 0;
    var oItem;
    while(oItem = System.Shell.itemFromFileDrop(event.dataTransfer, intIndex))
    {
        // Display the current item property and increment the index.
        spFeedback.innerHTML += oItem.name + "<br/>";        
        intIndex++;
    }
}

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

End of client support

Windows 7

End of server support

Windows Server 2008

IDL

Sidebar.idl

DLL

Sidebar.Exe (version 1.00 or later)

See also

System.Shell
System.Shell.Drive

 

 

Community Additions

ADD
Show:
© 2014 Microsoft