I am having trouble with the library function "GetCtrlVal". I am trying to obtain a value from a numeric box and put it into an "int" variable. I am running into a problem where if the current value of the variable is negative, when I obtain the new value from the numeric box, that value is complemented and then entered into the variable. For example, if the value in the numeric box is "200" and the current value of the int variable (say "i") is -10, then calling GetCtrlVal on the numeric box will result in -65336 being entered into the variable (i). But if the current value of the variable (i) is 10 (or anything positive), then the new value of i after GetCtrlVal would be correct(200). Despite that, when I try a isolated tes
t--one that's not part of the code I wrote--this does not happen and everything works correctly regardless of the current value of the variable I am writing to.
I have included the code I wrote that results in this behavior. The function consists mainly of two inner "for" loops inside another outer "for" loop. The variable in question is "logInt". If when the second inner "for" loop ends with logInt with a negative value (POINT A) then the next time the first inner "for" loop is executed, all the "GetCtrlVal" calls will result in values that are complemented in logInt (POINT B), in accordance to the behavior I described above. Can you help me figure what exactly is going on. I don't see how this can happen at all.