selectInput() の使い方

Post date: 2014/01/05 7:42:23

String fname; 
void load_data_input() { 
  noLoop(); // IMPORTANT !! 
  if(fname==null) selectInput("Select a *.mesh file:","fileSelected"); 
  while(fname==null) {delay(200);} // IMPORTANT !! 
  load_mesh(fname); 
  loop();  // IMPORTANT !! 
} 
void fileSelected(File selection) { 
  if (selection == null) { 
    println("Window was closed or the user hit cancel."); 
    exit(); 
  } else { 
    fname=selection.getAbsolutePath(); 
    println("User selected " + fname); 
  } 
}