ACCEPTFILEDROP: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
No edit summary
Tags: Manual revert Reverted
No edit summary
Tags: Undo Reverted
Line 12: Line 12:
* Use [[_DROPPEDFILE]] to read the list, either sequentially or by index.
* Use [[_DROPPEDFILE]] to read the list, either sequentially or by index.
* If using [[_DROPPEDFILE]] with an index, you must call [[_FINISHDROP]] after you finish working with the list.
* If using [[_DROPPEDFILE]] with an index, you must call [[_FINISHDROP]] after you finish working with the list.
* '''[[Keywords currently not supported by QB64#Keywords not supported in Linux or macOS versions|Keyword not supported in Linux or macOS versions]]'''
* '''[[Keywords_currently_not_supported_by_QB64#Keywords_not_supported_in_Linux_or_macOS_versions|Keyword not supported in Linux or macOS versions]]'''




Line 20: Line 20:


{{PageExamples}}
{{PageExamples}}
''Example:'' Accepting files dragged from a folder and processing the list received sequentially.
''Example:'' Accepting files dragged from a folder and processing the list received sequentially.  
{{CodeStart}}
{{CodeStart}}
{{Cl|SCREEN}} {{Cl|_NEWIMAGE}}(128, 25, 0)
{{Cl|SCREEN}} {{Cl|_NEWIMAGE}}(128, 25, 0)

Revision as of 23:10, 22 January 2023

The _ACCEPTFILEDROP statement prepares a program window to receive files dropped from Windows Explorer in a drag/drop operation.


Syntax

_ACCEPTFILEDROP [{ON|OFF}]


Description


Availability

  • Version 1.3 and up.


Examples

Example: Accepting files dragged from a folder and processing the list received sequentially.

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 'reads the list sequentially; when the result is empty ("") it means the list is over
            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
    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