- Processing
- p5.js
- Processing.py
- Processing for Android
- Processing for Pi

- Processing Foundation

This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Name | ### selectInput()
Examples |
    void setup() {
      selectInput("Select a file to process:", "fileSelected");
    }

    void fileSelected(File selection) {
      if (selection == null) {
        println("Window was closed or the user hit cancel.");
      } else {
        println("User selected " + selection.getAbsolutePath());
      }
    }
Description | Opens a platform-specific file chooser dialog to select a file for input. After the selection is made, the selected File will be passed to the 'callback' function. If the dialog is closed or canceled, null will be sent to the function, so that the program is not waiting for additional input. The callback is necessary because of how threading works.
Syntax |
    selectInput(prompt, callback)
    selectInput(prompt, callback, file)
    selectInput(prompt, callback, file, callbackObject)
    selectInput(prompt, callbackMethod, file, callbackObject, parent, sketch)
    selectInput(prompt, callbackMethod, file, callbackObject, parent)
Parameters |
prompt | String: message to the user
callback | String: name of the method to be called when the selection is made
Returns | void

Updated on January 1, 2021 03:38:07am EST
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.