What I am trying to do is when I click a button it draws a cube or whatever and displays the name of the object in a
GLUI_EDITTEXT_TEXT box.I also want to append a number to the end of the object name and increment the number each time a new object is drawn. I have everything working ok except the name and number will only display one character at a time in the textbox and increments the position each time the draw button is pushed. Much Thanks to anyone who will/can help with this. Jody Bush
Below is part of the code I have for this thing.
CODE
//My variables
int Cnum = 1;
int Pnum = 1;
char Cube[sizeof(GLUI_String)] ={" "};
char Plane[sizeof(GLUI_String)] ={" "};
char Name;
//my glui edittext
Name1 = subwin->add_edittext( "Name", GLUI_EDITTEXT_TEXT,&Name);
//my callback functions
if(control == DRAWPLANE_ID){
drawplane = true;
sizex = 1.0;
sizey = 1.0;
sizez = 0.0;
itoa(Pnum, Plane, 10);
sprintf(Plane,"Plane %d",Cnum);
Name = Plane[Pnum];
Name1->get_text();
Pnum++;
}
if(control == DRAWCUBE_ID){
drawcube = true;
sizex = 1.0;
sizey = 1.0;
sizez = 1.0;
itoa(Cnum, Cube, 10);
sprintf(Cube,"Cube %d",Cnum);
Name = Cube[Cnum];
Name1->get_text();
Cnum++;
}
This post has been edited by bushimports: 26 May, 2009 - 01:20 PM