We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
I have a problem somewhat strange, to make certain controls with ControlP5 library, I'll try to explain.
Please Andreas (sojamo), check if you can help it.
The project is being developed to make the "storytelling" illustrated stories where a person who is illiterate (patients with cognitive dificiencia or even children), recognize the following story through pictures.
When adding the buttons offering the options to choose from, it is added to the button names on a arrayList, and then whether the focus of the mouse is over button.
The problem is that the last button is not recognizing that the focus is on it ...
And even more curious still, when you have only two buttons, the second button acknowledges the focus on part of the button, while using from 3 buttons, the first two regular work, and the third simply do not recognize.
I know it's kind of complicated to explain it using a translator, but please, if it was not clear the problem, make a comment so I can try to explain better.
Below is the snippet of the code I'm using:
ArrayList targetsHist01 = new ArrayList();
//Validation em draw()
if (Collections.disjoint(cp5_Hist01.getMouseOverList(), targetsHist01)==false) {
if(cp5_Hist01.getMouseOverList().size()==1) {
controlP5.Controller controllerHist01 = (controlP5.Controller)(cp5_Hist01.getMouseOverList().get(0));
if (!fimHistoria){
String posicoes = controllerHist01.getLabel().toString();
String posBtnX = posicoes.substring(0,4);
String posBtnY = posicoes.substring(5,posicoes.length());
//controllerHist01.getPosition().x;
//PVector posBtnX2 = controllerHist01.getPosition();
println("Posicoes: " + frameRate, posBtnX, posBtnY);
desenhaBarraHist01(int(posBtnX)-25, int(posBtnY)+180, 5, 180);
//verificaTempo();
}
}
//Function used do add buttons
void selecionaObjetosHist01(){
dbHist01.query("SELECT * FROM HistoriaItem WHERE hisCodigo = '"+utilVar.idHistoria+"' AND hitSequencia = '"+seqHistoria+"' ");
dbHist01.next();
if (dbHist01.getInt("hitFleg") != 9){ //Se não for fim da História
textoHistoria = dbHist01.getString("hitFrase");
dbHist01_02.query("SELECT hitSequencia, hitFleg FROM HistoriaItem WHERE hisCodigo = '"+utilVar.idHistoria+"' AND hitFleg = 1 AND hitSequencia <> '"+seqHistoria+"' ORDER BY RANDOM() LIMIT '"+limiteFiguras+"' ");
seqBotoes++;
nomeBotoesHist01[0][0] = "btn"+nf(seqBotoes,4);
nomeBotoesHist01[0][1] = "1";
posicoesX.shuffle();
if (passo == 1){
if (utilVar.usaLeapMotion)
posY = height-250;
else
posY = height-350;
passo++;
} else if (passo == 2){
if (utilVar.usaLeapMotion)
posY = height-450;
else
posY = height-550;
passo = 1;
}
cp5_Hist01.addButton(nomeBotoesHist01[0][0])
.setPosition(posicoesX.get(0), posY)
.setImages(loadImage(PATHIMGMENUHISTORIAS+"/"+utilVar.idHistoria+"/"+seqHistoria+".jpg"), loadImage(PATHIMGMENUHISTORIAS+"/"+utilVar.idHistoria+"/Img1/"+seqHistoria+"_1.jpg"), loadImage(PATHIMGMENUHISTORIAS+"/"+utilVar.idHistoria+"/Img2/"+seqHistoria+"_2.jpg"))
.setValue(seqHistoria)
.setLabel(nf(posicoesX.get(0),4) + "," + nf(posY,4))
.updateSize();
targetsHist01.add(cp5_Hist01.getController(nomeBotoesHist01[0][0]));
int seqPosicao = 0;
while (dbHist01_02.next()){
seqPosicao++;
println("seq. " + seqPosicao);
//println("Hist/Seq --> Seq - Fleg.: " + utilVar.idHistoria, seqHistoria, dbHist01_02.getInt("hitSequencia"), dbHist01_02.getInt("hitFleg"));
seqBotoes++;
nomeBotoesHist01[seqPosicao][0] = "btn"+nf(seqBotoes,4);
nomeBotoesHist01[seqPosicao][1] = "2";
cp5_Hist01.addButton(nomeBotoesHist01[seqPosicao][0])
.setPosition(posicoesX.get(seqPosicao), posY)
.setImages(loadImage(PATHIMGMENUHISTORIAS+"/"+utilVar.idHistoria+"/"+dbHist01_02.getInt("hitSequencia")+".jpg"), loadImage(PATHIMGMENUHISTORIAS+"/"+utilVar.idHistoria+"/Img1/"+dbHist01_02.getInt("hitSequencia")+"_1.jpg"), loadImage(PATHIMGMENUHISTORIAS+"/"+utilVar.idHistoria+"/Img2/"+dbHist01_02.getInt("hitSequencia")+"_2.jpg"))
.setValue(seqBotoes)
.setLabel(nf(posicoesX.get(seqPosicao),4) + "," + nf(posY,4))
.updateSize();
targetsHist01.add(cp5_Hist01.getController(nomeBotoesHist01[seqPosicao][0]));
}
}
}
I really need help in this, not where to look for a solution ...
Thank you
Answers
I will leave an image, may help better understand what's going on. Thank you,
Hello,
I did something stupid in the current version, returned to work when I got an earlier version.
Anyway thank you.