Small GUI problem with default values and Fields
by ChrisP · in Torque Game Engine · 08/31/2005 (5:37 pm) · 2 replies
I've created a GUI that inherits from GuiBitmapCtrl and I have been experiencing a small problem. In the constructor, I set the default values of some of the class members (e.g. mQueryClientId = -1). During the game, the initial value is as expected. However, if I use an initPersistFields() function and add mQueryClientId as a field, the default value gets overwritten at some stage by another, large negative value. If I delete mQueryClientId as a field, then it works properly again and retains its default value. Does anybody have any idea if this is normal behaviour, or what may be causing it to happen?
#2
08/31/2005 (9:03 pm)
No, apart from in the constructor, it wasn't being assigned/reassigned by me in the meantime. The constructor did initially set the value to -1, but something after that had been resetting it. Since then, I've deleted mQueryClientId completely and put in some new variables (and assigned them as fields); they are working properly. Interestingly, when I went ingame after this and brought the GUI up in the editor, the old field related to mQueryClientId was still in there with the spurious value. I can only presume that it was an old field that got saved in the GUI and then hung around. I was registering it as the correct type though - I'll see if I can recreate the problem tomorrow.
Associate Kyle Carter