selectInput cannot find symbol

Hi, wandering if anyone can help please.

I’m struggling to build my latest library as the fileInput class is causing errors.

eclipse terminates the build process with the error

error: cannot find symbol
    [javac] 	    	selectInput("Select a file to process:", "folderSelected");

I’m not sure what this means and am unsure how to resolve this.

Many thanks

would changing the PApplet method to static make a difference, because I cannot call the function explicitly as it isnt static.

Hi @paulgoux

Does the example on the link below works for you?
https://www.processing.org/reference/selectInput_.html

Best regards

It works fine from the processing pde, but i cannot call it in a class in eclipse.

Did you try passing the PApplet to the constructor of the class and use it when selecting a file?
I think the problem is that the selectInput() assumes invocation by the main-sketch

public class Foo{
  private final PApplet pa;
 
  public Foo(PApplet p) {
    pa = p;
  }

public Foo chooseFile() {
    // Assumes PApplet's reference. Won't find callback:
    //pa.selectInput("Select a mesh to process:", "fileSelected");
 
    // Specifies Foo's reference. Callback is found:
    pa.selectInput("Select a mesh to process:", "fileSelected", null, this);
 
    return this;
  }

public void fileSelected(File selection) {
    final String path;
 
    if (selection == null){
      pa.println("Window was closed or the user hit cancel.");
    } else {
      pa.println("File selected.");
    }
 }
 

Others have had this problem as well:

Links

selectinput() in a class - Processing 2.x and 3.x Forum
selectInput(); in a class in Eclipse, callback not found - Processing 2.x and 3.x Forum

Best regards

1 Like

Ive tried passing the papplet and extending the class using papplet

Couldnt find a solution so i coded my own window file browser.