DROPPEDFILE: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:_DROPPEDFILE}} The _DROPPEDFILE function returns the list of items (files or folders) dropped in a program's window after _ACCEPTFILEDROP is enabled. {{PageSyntax}} ''Syntax 1'' : {{Parameter|nextItem$}} = _DROPPEDFILE ''Syntax 2'' : {{Parameter|nextItem$}} = _DROPPEDFILE({{Parameter|index&}}) {{PageDescription}} * After _ACCEPTFILEDROP is enabled, once _TOTALDROPPEDFILES is greater than 0 the list of dropped items will be avail...")
 
No edit summary
Line 15: Line 15:
* When using [[_DROPPEDFILE]] with an index (which goes from 1 to [[_TOTALDROPPEDFILES]]), you must call [[_FINISHDROP]] after you finish working with the list.
* When using [[_DROPPEDFILE]] with an index (which goes from 1 to [[_TOTALDROPPEDFILES]]), you must call [[_FINISHDROP]] after you finish working with the list.
* Because it returns a string, [[_DROPPEDFILE]] also accepts being followed by a string suffix ([[_DROPPEDFILE]]'''$''')
* Because it returns a string, [[_DROPPEDFILE]] also accepts being followed by a string suffix ([[_DROPPEDFILE]]'''$''')
* '''[[Keywords_currently_not_supported_by_QB64#Keywords_Not_Supported_in_Linux_or_MAC_OSX_versions|Keyword Not Supported in Linux or MAC versions]]'''.
* '''[[Keywords_currently_not_supported_by_QB64#Keywords_not_supported_in_Linux_or_macOS_versions|Keyword not supported in Linux or macOS versions]]'''





Revision as of 21:41, 12 November 2022

The _DROPPEDFILE function returns the list of items (files or folders) dropped in a program's window after _ACCEPTFILEDROP is enabled.


Syntax

Syntax 1

nextItem$ = _DROPPEDFILE

Syntax 2

nextItem$ = _DROPPEDFILE(index&)

Description


Availability

  • Version 1.3 and up.


Examples

Example: Accepting files dragged from a folder and processing the list received by specifying an index.

SCREEN _NEWIMAGE(128, 25, 0)

_ACCEPTFILEDROP 'enables drag/drop functionality
PRINT "Drag files from a folder and drop them in this window..."

DO
    IF _TOTALDROPPEDFILES THEN
        FOR i = 1 TO _TOTALDROPPEDFILES
            a$ = _DROPPEDFILE(i)
            COLOR 15
            PRINT i,
            IF _FILEEXISTS(a$) THEN
                COLOR 2: PRINT "file",
            ELSE
                IF _DIREXISTS(a$) THEN
                    COLOR 3: PRINT "folder",
                ELSE
                    COLOR 4: PRINT "not found", 'highly unlikely, but who knows?
                END IF
            END IF
            COLOR 15
            PRINT a$
        NEXT
        _FINISHDROP
    END IF

    _LIMIT 30
LOOP


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link