I'm implementing a textfield via Processing/Javascript, but I have a big problem, everything works perfectly, but something is wrong about special characters, they don't come out properly...like the underscore is actually an "m", the semicolon is a "1/4" symbol...so I think in javascript the keyboard input si mapped differently...is there any solution or workaround to solve this ?
I'm trying to make a Processing script work on a web page, but I can't use the Java deployer (like it does when you export an applet) so I have to use the Processing Code just as Javascript, inside a canvas. The only problem (huuuge problem) is that most of the code is not working anymore, like the double click and much more...I just made the whole applet on my own, I even implemented a popupmenu without importing any library (bc it won't work on a web page if I import java libraries) and even if it works on Processing IDE, it barely works on a web page.
Just to make an example a line like this:
mouseEvent.getClickCount()== 2
doesn't work (and I know the reason why)...I'll probably ask you for more help bc I'm losing my mind, it's like rewriting everything with a different logic or something..
Well...I'm wondering if there's any chance I can parse an XML via ProcessingJS..I mean, I know this isn't possible (unless the XML is in the data folder) but do you think is there any hack to do that ?
Maybe with JavaScript Help..I really have no Idea...thanks ;)
Here's the problem...let's suppose I have a simple HTML page with two textfields, the user type in, I don't know, let's say his name and surname, then when he/she presses Enter I get this code...(generated Html):
Well..I have a very strange problem...I'm working on a big project with Processing, and I need to know the Width of a simple text that appears on a popup...the strange thing is this:
1. the textWidth(string) in the Setup section gives me 96
2. the textWidth(string) in the Draw section gives me 100
3. the textWidth(string) called when the popup appears gives me 100 the first time and 109 the second time and the third,...
I'm sorry but I have no Idea why this happens...and, of course, the string is always the same! Do you have any idea why textWidth() is acting like this ?
Thank you guys =3
PS = I tried point 1 and 2 even if they are actually useless just trying to know where the problem was..
I have a little and easy problem to fix with the controlP5 textfield...I changed the font of the text inside the textfield but for some reasons (and here is the problem), if I keep typing, the writing goes outside the textfield...
_________________
| Writing something a|nd it goes outside the field O_o
|_________________|
I'll keep trying to find a solution...when I use the standard font this doesn't happen.
Here is a very very simplified edition of an application I'm working on...it's supposed to display some circles connected by a line (edges). Circles and edges are different objects. My problem is that I want a circle to disappear if I click on it and the edge too should be deleted. Each edge link the root to each other circle. I got an error on line 64 that I don't know how to handle (IndexOutOfBounds...). I'm sure there's something really stupid I'm not seeing...I think I understand the error but I really don't know how to handle it...need your help guys...I'd appreciate any kind of help...Thank you =D
ArrayList nodes;
ArrayList edges;
void setup(){
size(500,500);
nodes = new ArrayList();
edges = new ArrayList();
nodes.add( new Node(0));
nodes.add( new Node(150, 275, 1));
nodes.add( new Node(200, 275, 2));
nodes.add( new Node(250, 275, 3));
nodes.add( new Node(300, 275, 4));
edges.add( new Edge((Node)nodes.get(0), (Node)nodes.get(1)));
edges.add( new Edge((Node)nodes.get(0), (Node)nodes.get(2)));
edges.add( new Edge((Node)nodes.get(0), (Node)nodes.get(3)));
edges.add( new Edge((Node)nodes.get(0), (Node)nodes.get(4)));
}
void draw(){
background(255,255,255);
for(int i=0; i<nodes.size(); i++){
Node n = (Node) nodes.get(i);
n.display();
}
for(int j=0; j<edges.size(); j++){
Edge e = (Edge) edges.get(j);
e.display();
}
}
class Node {
int xpos, ypos;
int id;
Node(int i){
id = i;
xpos = width/2;
ypos = height/5;
}
Node(int x, int y, int i){
id = i;
xpos = x;
ypos = y;
}
void display(){
smooth();
ellipse(xpos, ypos, 20, 20);
}
}
class Edge {
int idOr, idDest;
Edge(Node or, Node dest){
idOr = or.id;
idDest = dest.id;
}
void display(){
smooth();
Node orig = (Node) nodes.get(this.idOr);
Node dest = (Node) nodes.get(this.idDest); // Processing underline this line when the error is generated
Basically I have two problems, quite simple, but I'll ask you guys..
I want a menu to appear when I right click on the screen, easy...but I want that menu tu be still displayed where I clicked (not following the mouse position anymore) and eventually disappear when I left click on a menu field...(I'm not asking you how to implement a menu that's something I've quite done, but just how to handle this mouse problem I have)...
And second question, I don't know why but anytime I have to display a simple text, the app starts slowly...I was trying just to display a rect and a text, the app displayed the rect and after 3-4 seconds the text appeared...dunno why!
I have a problem that can maybe solved in an easy way (almost easy) but I'm not sure that much, so I'm gonna ask you...Is there any chance I can display objects (such as little squares) along a defined ellipse ?
I know I can do that with rotation and so on (there's a tutorial about it), but I was wondering if there is another way to do that...
size(200, 200);
xml = new XMLElement(this, "anywhere/test.xml");
}
void draw(){
background(0,0,0);
}
This lines of code (simplified) won't work. If i try to run this on my computer with the Processing IDE that will perfectly work and the xml file I'm using can be anywhere (local, server, data folder). But if I try to put this inside an html webpage as a script it won't work at all, if I comment the line "xml = new ..." a black square will appear, so that line is making trouble and I really don't know the reason why. I tried to locate that xml file anywhere local, folder, another server but it won't work. Thank you guys ;)
Hi everybody,
I'm traying to make a tree structure where every node can be dragged anywhere. I'm having a problem about the dragging part. First of all if I keep the mouse pressed anywhere and I move it over a node it will drag it wherever I put the mouse, but I want that to happen only if the mouse is first pressed over the node. Becuase of this, if I'm already dragging a node and the mouse pass over another node then I'll be dragging two nodes, or three, and so on. I thought about using a global boolean var but it doesn't seem to work..here a piece of code...