We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Pages: 1 ... 10 11 12 13 14 ... 17
controlP5 (Read 126737 times)
Re: controlP5
Reply #165 - Aug 24th, 2009, 10:32am
 
Hi Sojamo,

Yep, sure - many thanks for taking a look. I can send you a working example if it would help but couldn't see how to attach one to this post.

In setup() I have:
Code:

 controlP5 = new ControlP5(this);
 
 Radio rCountry = controlP5.addRadio("radioCountry",20,20);
 rCountry.add("All",0);
 rCountry.add("DE",1);
 rCountry.add("FR",2);
 rCountry.add("UK",3);
 
 Radio rChannel = controlP5.addRadio("radioChannel",60,20);
 rChannel.add("All",0);
 rChannel.add("Acquisition email",1);
 rChannel.add("Online / Affiliate",2);
 rChannel.add("Organic search",3);
 rChannel.add("Paid search",4);
 rChannel.add("Retention email",5);
 
 Radio rPageType = controlP5.addRadio("radioPageType",160,20);
 rPageType.add("All",0);
 rPageType.add("Homepage",1);
 rPageType.add("Splash",2);
 rPageType.add("Product",3);
 rPageType.add("Gallery",4);
 rPageType.add("Studio",5);
 rPageType.add("Sign in",6);
 rPageType.add("Order pipeline",7);
 rPageType.add("Other",8);


My functions are:
Code:

void radioCountry(int theID) {
 switch(theID) {
   case(0):
     selectedCountry = "All";
     break;  
   case(1):
     selectedCountry = "DE";
     break;  
   case(2):
     selectedCountry = "FR";
     break;  
   case(3):
     selectedCountry = "UK";
     break;
 }
}

void radioChannel(int theID) {
 switch(theID) {
   case(0):
     selectedChannel = "All";    
     break;  
   case(1):
     selectedChannel = "Acquisition email";
     break;  
   case(2):
     selectedChannel = "Online / Affiliate";
     break;  
   case(3):
     selectedChannel = "Organic search";
     break;
   case(4):
     selectedChannel = "Paid search";    
     break;  
   case(5):
     selectedChannel = "Retention email";
     break;
    }
}

void radioPageType(int theID) {
 switch(theID) {
   case(0):
     selectedPageType = "All";    
     break;  
   case(1):
     selectedPageType = "Homepage";
     break;  
   case(2):
     selectedPageType = "Splash";
     break;  
   case(3):
     selectedPageType = "Product";
     break;
   case(4):
     selectedPageType = "Gallery";
     break;  
   case(5):
     selectedPageType = "Studio";
     break;
    case(6):
     selectedPageType = "Sign in";
     break;
   case(7):
     selectedPageType = "Order pipeline";
     break;  
   case(8):
     selectedPageType = "Other";
     break;
    }
}


And in draw() I have:
Code:

if((selectedCountry.equals("All") || selectedCountry.equals(sCountry))
 && (selectedChannel.equals("All") || selectedChannel.equals(sChannel))
 && (selectedPageType.equals("All") || selectedPageType.equals(sPageType))
 && (x <= axisMaxX)
 && (y <= axisMaxY)) {
   // draw data
}


- David
Re: controlP5
Reply #166 - Aug 26th, 2009, 7:37am
 
Hi Sojamo,

I've narrowed the problem down to one of string length. The issue appears when I add a radio button with a name longer than 13 characters.

In the example below the 14 character name in the 2nd item of the first radio control causes the 1st, 2nd, 3rd and 4th items of the second radio control to be unselectable (the 5th and 6th are selectable).

It doesn't seem to matter which item has the long name, it always causes the same number of items in the second radio control as there are in the first radio control to be unselectable (i.e. items 0-3 in this example).

Code:

controlP5 = new ControlP5(this);
 
 Radio rTest1 = controlP5.addRadio("Test1", 20, 20);
 rCountry.add("a" ,0);
 rCountry.add("bbbbbbbbbbbbbb", 1); // 14 character name
 rCountry.add("c", 2);
 rCountry.add("d", 3);
 
 Radio rTest2 = controlP5.addRadio("Test2", 60, 20);
 rChannel.add("A", 0); // item can NOT be selected
 rChannel.add("B", 1); // item can NOT be selected
 rChannel.add("C", 2); // item can NOT be selected
 rChannel.add("D", 3); // item can NOT be selected
 rChannel.add("E", 4); // item can be selected
 rChannel.add("F", 5); // item can be selected


My complex work around is to...have shorter names, but thought you might want to investigate this / explain what I've done wrong!

Thanks, David
Re: controlP5
Reply #167 - Aug 26th, 2009, 9:30am
 
hi,
i get the same effect. the reason being that the bounding box of rTest1 is overlapping with rTest2 and therefore the mouseClick is disabled for rTest2-buttons 1-4. if you initiate rTest2 before initiating rTest1,  this effect will disappear - this could be a workaround (but then label bbb... will be on top of rTest2 which i guess is visually not what you want).
Re: controlP5
Reply #168 - Sep 3rd, 2009, 8:45am
 
Im trying to setup some tabs and they are rendered starting at 0,0 and I cant find a way to change the position of them. If i use setPosition, it changes the position of the controls the tab contains.

Any ideas?
Re: controlP5
Reply #169 - Sep 3rd, 2009, 10:49am
 
Hi everyone,

One question: If I click a controlP5 button, I can still pick up the same click in mouseClicked(). How do I NOT pick this up in mouseClicked()? Same thing goes with keys pressed in input textbox. Thanks a lot.
Re: controlP5
Reply #170 - Sep 3rd, 2009, 12:42pm
 
Im getting some errors with my ScrollList code but I noticed that the example code on the ControlP5 site also gives the same errors:

ERROR. an error occured while forwarding a Controller value
to a method in your program. please check your code for any
possible errors that might occur in this method .
e.g. check for casting errors, possible nullpointers, array overflows ... .
method: controlEvent
exception:  java.lang.reflect.InvocationTargetException
114  /  controlP5.Button@1402c4  /  14.0

Is this a known problem?
Re: controlP5
Reply #171 - Sep 10th, 2009, 10:33am
 
Questions about Tabs:

How can I tell what tab is active?

How can I set a tab to be active? For instance I have a file loader tab and when i click on a file and it is finished loading I want it to automatically switch to the main tab.

Re: controlP5
Reply #172 - Sep 10th, 2009, 9:00pm
 
hi,
the methods you are looking for are included in the controlWindow class, currentTab and activateTab.
to check which tab is currently active in your sketch window use for example:

Code:

void draw() {
println(controlP5.window(this).currentTab().name());
}


to activate a tab within your source code, use for example:
Code:


void keyPressed() {
if(key=='1') {
// default is the main tab
controlP5.window(this).activateTab("default");
} else if (key=='2') {
// switch to a tab called extra
controlP5.window(this).activateTab("extra");
}
}



best,
andreas


Re: controlP5
Reply #173 - Sep 16th, 2009, 2:25am
 
Hi Sojamo,

ControlP5 is a great library!

I read that you're working about a new release of this library. Any news about it?

I would like to make a custom controller cause ControlCanvas doesn't throw control event and it's very annoying for me.

Thanks for your great job!
Re: controlP5
Reply #174 - Nov 22nd, 2009, 9:26pm
 
Great library!

by the way, how can i use characters like "@" or "ń", because im from chile and i need to enter those kinds of characters.

thanks!

PD: my english sucks
Re: controlP5
Reply #175 - Nov 23rd, 2009, 4:12am
 
As far as I know, it doesn't support Unicode characters.  I had to convert all my text with this statement.
Code:
String = firststring;
String = endstring;
byte[] bytes;
try {
bytes = firststring.getBytes("LATIN1");
endstring = new String(bytes);
} catch (Exception e) {
println(e); }
Re: controlP5
Reply #176 - Nov 25th, 2009, 11:05am
 
thanks jeffg

other thing, I want to write in a textfield more than 1 line, but I don't know how to do that.
I have:

Code:
cp5.addTextfield("Screen",5,20,100,60);

but if you keep writing until you pass the right border (pixel 100), then you can't see what are you writing.

how can I change it to write in lines like a textarea?

thanks!
Martin
Re: controlP5
Reply #177 - Nov 25th, 2009, 10:52pm
 
Whats the latest version of ControlP5 ? i just downloaded Toxis Decode09 Identity and still get the error

function setDecimalPrecision(); doesnt exsist.

I installed the latest version  (controlP5 0.3.14 ) from your website.
Do I miss something ?
Re: controlP5
Reply #178 - Nov 26th, 2009, 8:12am
 
hi, i update controlP5 to version 0.4.2 with new features like ControlFont (not implemented for textfield and textarea yet), CheckBox, ListBox and made adjustments based on feedback and suggestions. i am not happy with the documentation yet, but since there are apps out there using a newer version than 0.3.14, i did update to 0.4.2
please let me know if anything did break or doesnt work as before, i tried hard to keep existing implementations as compatible as possible.

andreas
Re: controlP5
Reply #179 - Nov 26th, 2009, 9:34am
 
Thank you!
Pages: 1 ... 10 11 12 13 14 ... 17