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 ... 15 16 17 
controlP5 (Read 126743 times)
Re: controlP5
Reply #240 - May 17th, 2010, 3:19am
 
Andrew wrote on May 10th, 2010, 12:02am:
I've managed to get around my previous problem (sort of) by setting the control font of each text fields individually

Also I've noticed that for some reason toUpperCase(false) has no effect. Either before or after setting the label value (also talking about the text fields)


I'm having this problem too, can you share your code Thanks.  Smiley
Re: controlP5
Reply #241 - May 17th, 2010, 7:02am
 
Hey Sojamo,

I'm just starting to play with controlWindow, and wonder if there's a way to resize the window after it's created. I've tried setSize, setWidth, etc, to no effect.

So far I've gotten around the issue by removing the window and recreating it at the desired size, but then I seem to need to use setWindow on each item that was previously assigned to the window.

--

I'm also interested in if it's possible to create an item directly on a control window, rather than using setWindow after it's created. something along the lines of Code:
controlWindow.addButton()... 



Thanks for your help and for a great library.
Re: controlP5
Reply #242 - May 17th, 2010, 12:34pm
 
Hi Sojamo,

          Thanks for your contribution and help to resolve doubts in ControlP5 and I have a doubt in List box usage, If you can help me It would really help for my project and What my query is..

                  I would like to use List box in my application so that I have added list box code and named 12 months like Jan,Feb..,Dec.
but I added the values in the form of key value pairs. So once I selected month from List I got only the value of the month only How should i get the Name of the month like "Jan"/"Feb" that values needed for me further implementation of code. I know its a small question but I am not much aware about processing language advance thanks for your help..

I am giving sample code which I am unable to retrive the selected month.. how should I get month values in void draw() method.

import controlP5.*;

ControlP5 controlP5;

ListBox l;
int cnt = 0;
PImage mapImage;
Table locationTable;
int rowCount;
color bg = color(255);
public void setup( ) {
size(640, 400);

// list box start

 frameRate(30);
 controlP5 = new ControlP5(this);
 l = controlP5.addListBox("myList",10,10,100,100);
 l.setItemHeight(10);
 l.setBarHeight(10);

 l.captionLabel().toUpperCase(true);
 l.captionLabel().set("Select Month");
 l.captionLabel().style().marginTop = 3;
 l.valueLabel().style().marginTop = 3; // the +/- sign
 //l.setBackgroundColor(color(100,0,0));
// for(int i=0;i<12;i++) {
//    if(i==0){
 //   l.addItem("Jan",0);
   //}
  l.addItem("Jan",0);
  l.addItem("Feb",1);
  l.addItem("Mar",2);
  l.addItem("Apr",3);
  l.addItem("May",4);
  l.addItem("Jun",5);
  l.addItem("Jul",6);
  l.addItem("Aug",7);
  l.addItem("Sep",8);
  l.addItem("Oct",9);
  l.addItem("Nov",10);
  l.addItem("Dec",11);
//  }
 l.setColorBackground(color(30,128));
 l.setColorActive(color(0,0,30,128));

// list box end
mapImage = loadImage("ireland.png");
// Make a data table from a file that contains
// the coordinates of each state.
locationTable = new Table("irelanddata.tsv");
// The row count will be used a lot, so store it globally.
rowCount = locationTable.getRowCount( );
PFont font = loadFont("Arial-BoldMT-16.vlw");
textFont(font);
}
void controlEvent(ControlEvent theEvent) {
 // ListBox is if type ControlGroup.
 // 1 controlEvent will be executed, where the event
 // originates from a ControlGroup. therefore
 // you need to check the Event with
 // if (theEvent.isGroup())
 // to avoid an error message from controlP5.
 
 if (theEvent.isGroup()) {
   // an event from a group e.g. scrollList
   println(theEvent.group().value()+" from "+theEvent.group());
   println(theEvent.group());
 }
}
Re: controlP5
Reply #243 - May 18th, 2010, 4:37am
 
Hi,

I think I've come across a bug with radioButtons. Activating a radio button in code does not seem to affect the value returned for the radio buttons, though does change the selection, whereas clicking on them does.

From your example code:
inserting Code:
pvoid keyPressed() {
 if(key==' ') {
   r.deactivateAll();
 } else if (key=='a') {
   r.activate("50");
 } else if(key>='0' && key<'5') {
   // convert a key-number (48-52) to an int between 0 and 4
   int n = int(key)-48;
   println("n is: " + n);
   r.activate(4);  
   println("radio button is: " + r.value());  
 }
}
demonstrates that regardless of what is set, r.value stays the same at 1.0.

Much of my code relies on being able to test which radio button is currently selected, so I would be very appreciative of a fix!

cheers
Re: controlP5
Reply #244 - May 19th, 2010, 3:37am
 
Steve Winton wrote on May 17th, 2010, 3:19am:
Andrew wrote on May 10th, 2010, 12:02am:
I've managed to get around my previous problem (sort of) by setting the control font of each text fields individually

Also I've noticed that for some reason toUpperCase(false) has no effect. Either before or after setting the label value (also talking about the text fields)


I'm having this problem too, can you share your code Thanks.  Smiley



Sure no problem, hope it helps:
Quote:
    controlP5.controller("text").valueLabel().setControlFont(fonT);
    controlP5.controller("text").captionLabel().setControlFont(fonT);

Re: controlP5
Reply #245 - May 19th, 2010, 8:27am
 
Hi. First of all, thanks for controlP5, it's an awesome library.

I have a simple question: Is there any way to make controlP5 less CPU intensive? I know about ControlWindow.ECONOMIC but in the sketch I'm working at a ControlWindow is not an option.

Thanks!
ControlP5Matrix Bug
Reply #246 - May 19th, 2010, 10:00am
 
beautiful library!

i discovered a bug in the ControlP5Matrix example:
you get an error ("push()matrix cannot use push more than 32 times") when you leave the matrix box with a pressed mouse button.

hope bug reports helps you. is there a better place to post them?

best,
sebastian

macbook
snow leopard 10.6.3
processing 1.1
controlP5 0.5.0
Re: controlP5
Reply #247 - Jun 5th, 2010, 5:11am
 
One quick question (relatively newbie to Processing and ControlP5):

Is it possible to use the coordinates of a ControlWindow inside the main sketch? I'd like to be able to pass the x,y coordinates to a class inside the main sketh - is that possible?

Thanks for a great library!

Re: controlP5
Reply #248 - Jun 10th, 2010, 6:31pm
 
hi validvalue,
you can get the window location by calling getLocation() of a controlWindow's frame component like this:
Code:

float x = controlWindow.papplet().frame.getLocation().x;
float y = controlWindow.papplet().frame.getLocation().y;

(the location only is updated after moving a window, not while it is being moving)
best, andreas
Re: controlP5
Reply #249 - Jun 10th, 2010, 6:35pm
 
@slex, thanks for reporting. will fix it.
thanks for all the other suggestions and hints as well, working on it now.
Pages: 1 ... 15 16 17