
FB II Compiler
PG PRO
Debugging
Memory
System
Mathematics
Resources
Disk I/O
Windows
Controls
Menus
Mouse
Keyboard
Text
Fonts
Drawing
Sound
Clipboard
Printing
Communication
ASM |
PG PRO
Know the limits of user objects
I'm using user objects in PGPro and, just like the manual suggests, I'm storing a handle to the object in the gObjUserHndl& field. This works fine if I only use one window of that class type. However, if I need multiple copies of the window, it doesn't work. Even though there are multiple windows, there appears to be only a single gObjUserHndl& field. I have a workaround, but it has it's own problems. I'm wondering if any one else has run across this problem and solved it. Any help would be appreciated.
For exactly the reason you describe, I avoid gObjUserHndl&. Instead, I set up an array of handles
DIM gMyDataHndl&(_maxWnds)
so I have a unique one for each window. In fact, I have taken this one step further, and defined a data structure to keep track of multiple bits of data about a window and then dim an array of that structure.
Thanks for the response, Greg. But to complicate things a bit further, what if I want to have multiple copies of the user object in a window? Then I'd have to either create multiple statement similar to 'DIM gMyDataHndl&(_maxWnds)', or set one up as a two dimensional array. Things start to get pretty complicated and one ends up setting aside a lot of memory of which only a small portion gets used. Do you have similar situations and if so, how do you handle them?
I ran into the same sort of problem, and ended up using Ross (lambert's) solution.
Create an edit field that is out of sight/not in the visible area of the window, make it static, and store your handle(s) in it/them. You will need an edit field for each handle or whatever for each window, but it does work.
|