Annonce

>>> Bienvenue sur codelab! >>> Première visite ? >>> quelques mots sur codelab //// une carte des membres//// (apéros) codelab


#1 2013-11-19 01:59:23 selectinput()

imdidi
membre
Date d'inscription: 2012-10-05
Messages: 242

selectinput()



bonjour a tous

je veux utiliser selectinput() pour importer le path name d un fichier dans pure data

si selectinput() n est pas dans une classe tous fonctionne super bien mais quand je le met dans ma classe

il me dit "fileSelected() could not be found" mais pourtant il est dans ma classe

il y a t il quelque chose que j ai pas compris ?

void mp3Parametre() {
  float mx = 30, my = 40,x1=40,y1=50,x2=40,y2=90,x3=40,y3=130,x4=40,y4=170;
  float masterRectSizeX = 200, masterRectSizeY = 175, rectSizeX = 180, rectSizeY = 30;
  float String1 = textWidth(file0_());
  //float xpos = 75;
  //int speed = 1;
  float test10;
 
 if(tcurState == 0){
   setMp3boolClose_(1);}
 
  pushStyle();

          stroke(255);
          strokeWeight(2);
          fill(100);
          rect(mx,my,masterRectSizeX,masterRectSizeY,7);
          pushMatrix();
          fill(50);

          rect(x1,y1,rectSizeX,rectSizeY,7);
          pushStyle();
          fill(255);
          textAlign(CENTER);
         //if(String1 > x1) {
           text(file0_(),xpos_(),my+y1-20);
          
          //setXpos_(-speed_());
          
          //else{text(file0_(),mx+x1+7,my+y1-20); }
          
          if(xpos_()<20){
           setXpos_(250); }  
           
          popStyle();
         // println(xpos_());
          
          rect(x2,y2,rectSizeX,rectSizeY,7);
          pushStyle();
          fill(255);
          textAlign(CENTER);
          text(file1_(),mx+x2+7,my+y2-20);
          popStyle();
          
          rect(x3,y3,rectSizeX,rectSizeY,7);
          pushStyle();
          fill(255);
          textAlign(CENTER);
          text(file2_(),mx+x3+7,my+y3-20);
          popStyle();
          
          rect(x4,y4,rectSizeX,rectSizeY,7);
          pushStyle();
          fill(255);
          textAlign(CENTER);
          text(file3_(),mx+x4+7,my+y4-20);
          popStyle();
          
          
          popStyle();
          pushStyle();
       
          if(overRect(fidposScreenX_()+x1,fidposScreenY_()+y1,rectSizeX,rectSizeY) && (tcurState_() == 1)) {
          fill(255);
          rect(x1,y1,rectSizeX,rectSizeY,7);
        // setFilebool1_(1);
          selectInput("Select a file to process:", "fileSelected1");
          setMp3bool_(0);
          setFidParamColor_(255,255,255,230);
        }
                    
         popStyle(); 
         pushStyle();
          if(overRect(fidposScreenX_()+x2,fidposScreenY_()+y2,rectSizeX,rectSizeY) && (tcurState_() == 1)) {
            fill(255);
            rect(x2,y2,rectSizeX,rectSizeY,7);
            selectInput("Select a file to process:", "fileSelected2");
            setMp3bool_(0);
            setFidParamColor_(255,255,255,230);
          }
          popStyle();
          pushStyle();
          if(overRect(fidposScreenX_()+x3,fidposScreenY_()+y3,rectSizeX,rectSizeY) && (tcurState_() == 1)) {
            fill(255);
            rect(x3,y3,rectSizeX,rectSizeY,7);
            selectInput("Select a file to process:", "fileSelected3");
            setMp3bool_(0);
            setFidParamColor_(255,255,255,230);
          }
          popStyle();
          pushStyle();
          if(overRect(fidposScreenX_()+x4,fidposScreenY_()+y4,rectSizeX,rectSizeY) && (tcurState_() == 1)) {
            fill(255);
            rect(x4,y4,rectSizeX,rectSizeY,7);
            selectInput("Select a file to process:", "fileSelected4");
            setMp3bool_(0);
            setFidParamColor_(255,255,255,230);
          }
          if(overRect1(mx+fidposScreenX_(),my+fidposScreenY_(),200,175) && (tcurState_() == 1) && (mp3BoolClose_() == 1)) {
           setMp3bool_(0);
           setMp3boolClose_(0); 
           setFidParamColor_(255,255,255,230); }
           
          else{ setCloseParamColor_(255,255,255,230);
                setCloseParamRectColor_(50); }
          
          popStyle();
          popMatrix();
          
  }
//---------------------------------------------------------------------
void fileSelected1(File selection) {
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
  } else {
    println("User selected " + selection.getPath());
    setPdFilePath1_(join(split(selection.getPath(), '\\'), "/"));
    setFilebool1_(1);
  }
}
//---------------------------------------------------------------------
void fileSelected2(File selection) {
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
  } else {
    println("User selected " + selection.getPath());
    setPdFilePath2_(join(split(selection.getPath(), '\\'), "/"));
    setFilebool2_(1);
  }
}
//---------------------------------------------------------------------
void fileSelected3(File selection) {
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
  } else {
    println("User selected " + selection.getPath());
    setPdFilePath3_(join(split(selection.getPath(), '\\'), "/"));
    setFilebool3_(1);
  }
}
//---------------------------------------------------------------------
void fileSelected4(File selection) {
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
  } else {
    println("User selected " + selection.getPath());
    setPdFilePath4_(join(split(selection.getPath(), '\\'), "/"));
    setFilebool4_(1);
  }
}

quelqu un pourrais m aider a résoudre le problème ?
merci
a+

Hors ligne

 

#2 2013-11-20 15:55:25 Re : selectinput()

imdidi
membre
Date d'inscription: 2012-10-05
Messages: 242

Re: selectinput()



salut a tous

pas de solution ? d accord je continue de chercher dans ce cas

merci a+

Hors ligne

 

#3 2013-11-20 21:27:51 Re : selectinput()

imdidi
membre
Date d'inscription: 2012-10-05
Messages: 242

Re: selectinput()



salut a tous

pour ceux que sa peut intéresser j'ai trouver la solution au problème du selectinput() dans une classe
car la fonction recherche uniquement le void en dehors d'une classe et non dans.
je sais pas si ses la bonne façon mais sa fonctionne pour moi

pour remedier a ce probleme au lieu d'utiliser la fonction comme sa:

selectInput("Select a file to process:", "fileSelected");

il faut l utiliser comme sa:

selectInput("Select a file to process:", "fileSelected", null, this);

ce que sa fait, sa change l erreur a place d avoir "fileSelected not found"
sa donne l erreur "fileSelected() must be public"

alors on ajoute public devant la class et le tour est joué

public class test {}

merci
a+

Hors ligne

 

fil rss de cette discussion : rss

Pied de page des forums

Powered by FluxBB

codelab, graphisme & code : emoc / 2008-2025