Quote:how to pass the text from the textfield and the language from the button
You have to check controlP5 documentation for that, but it is likely to be something like
String s = myTextfield.getText(); and you have to associate the button to a method (if that's similar to Swing -- I haven't used controlP5 yet).
[EDIT] I was right for the button, see
Button example, you use a controlEvent method (common to all buttons) and use the ID to know which button have been clicked.
Same for
Textfield:
println(myTextfield.getText()); Quote:enum's are not supported by processing
Wrong. Well, half wrong... You cannot declare enums in a .pde file. But you can very well use them.
Example, reusing an old enum class I made to test this new functionality:
TestEnum.java Code:public enum TestEnum
{
Number1(1, new String[] { "ichi", "one", "un", "uno" }, false),
Number2(2, new String[] { "ni", "two", "deux", "dos" }, true),
Number3(3, new String[] { "san", "three", "trois", "tres" }, false),
Number4(4, new String[] { "shi", "four", "quatre", "quatro" }, true);
private final int m_value;
private final String[] m_names;
private final boolean m_bEven;
TestEnum(int value, String[] names, boolean bEven)
{
m_value = value;
m_names = names;
m_bEven = bEven;
}
String[] GetNames()
{
return m_names;
}
String GetNameList()
{
if (m_names == null || m_names.length == 0)
return "";
StringBuilder names = new StringBuilder();
for (String name : m_names)
{
names.append(name).append(", ");
}
return names.delete(names.length() - 2, names.length() - 1).toString();
}
int GetValue()
{
return m_value;
}
boolean IsEven()
{
return m_bEven;
}
}
TestingEnums.pde Code: TestEnum ev = TestEnum.valueOf("Number1");
System.out.printf("Enumeration: %s (%s) = %d -- %s (%b) = %d\n",
ev, ev.name(), ev.ordinal(), ev.GetNameList(), ev.IsEven(), ev.GetValue());
TestEnum[] enums = TestEnum.values();
for (int i = 0; i < enums.length; i++)
{
TestEnum te = enums[i];
System.out.printf("%d) %s = %d -- %s (%b)\n",
te.ordinal(), te.name(), te.GetValue(), te.GetNameList(), te.IsEven());
}