you would need to add a dbSync(); into you while loop....thats the basic problem with why it wont work when it draws... essentially what a "while..do" loop does, is it tells your program to STOP COMPLETELY UNITL.. the condition the while loop is evaluating becomes true... this means that only the code inside that while loop is executing, every time you use a while loop, you need to ensure that you include an exit condition that can become true from code inside the while loop itself(which you have done, i think it was just the assignment operator in the while conditional you got mixed up)....
you while loop would look like this..
// example
while (edit_mode == true) // this will loop until edit_mode becomes false, while (edit_mode == false) is it's oppsoite
{
if ( edit_mode == false ) { break; }
if (dbReturnKey () ) { if(edit_mode) { edit_mode = false; } }
if (dbLeftKey () ) dbPositionObject(NewBox, -10,0,-5);
dbSync(); // this command tells GDK to draw everything that has happend
}
also, the value edit_mode, i assume is a boolean, declared somewhere in you program, for instance :
bool edit_mode;
otherwise if its an integer or something, the if and while statements would need to use logic operator "==" thats 2 equal signs... as oppsoed to the asignment operator "=" thats 1 equal sign... difference is that the logic operator evaluates the values on the left against the one on the right to be either true or false... the assignment operator will assign the value on the right of the operator, to the variable on the left of the operator( its saying make whats on the left of the equal sign the same as whats on the right)
Also you would need to be careful with long logic checks like you are doing with the mouse position, sometimes they might not return the result that you are expecting them too, read up on the Visual c++ compiler's operator precedence to find out how it evaluates logic operators, and making a few more checks that are slighly smaller may help
Lastly, im not sure if you missed it or its declared globally, the object number that you pass to create your objects in the function boxcreator would need to be defined and incremented each time the function is called if its called more than once.
Note: The code tags are HTML code tags that you can use to make the little "code snippet" clicky thingies(technical term there

).. the start code one is a set of square braces with the word "code" inside it, then the code snippet, then another set of square brackets with "/code" between them(without the quotations).. press the button at the top of the post message dialog that says code... then past in your code snippet, then click that button again. that button will put the html code tags down for you.
If it ain't broke.... DONT FIX IT !!!