If there is too much to post there is too much to work with. Strip out the non related code and post a small complete program the compiles, executes and shows the problem.