Ghost images??

HARRY

Active Member
Licensed User
Longtime User
Hi,

A program running on the PDA opens via the Show method another form, say the ViewForm. On the Show event in the ViewForm a circle is drawn and via AddImageButton 20 buttons are created. The Image property is not used, just the Text property and the Transparent property (true). Based on GPS data the position of the imagebuttons is changed via the Left and Top property, using a timer. This runs fine.

Now the user leaves that form via the Close method. Somewhat later on the user opens again that ViewForm. The circle is drawn again and the image buttons are newly created and again positioned based on GPS data.

However, also the image buttons which were shown on the moment of closing the ViewForm are shown on the 'old' positions. The new buttons are repositioned based on GPS data; the old ones stay where they are.

When closing the form, I assume that the image buttons are destroyed as they can be recreated without an error message that they exist already.
Should I clear the form before the close? But How?

Am I doing something wrong?

I cannot test it on the PC as I have no separate GPS device.

Please, can somebody help me?


Harry
 

Cableguy

Expert
Licensed User
Longtime User
Hi,

When closing the form, I assume that the image buttons are destroyed as they can be recreated without an error message that they exist already.
You assume wrong...You must dispose of all the newly created controld before creating them again...
Or re-use them, cahnging they caption and position...
 

HARRY

Active Member
Licensed User
Longtime User
Hi Paulo,

Thanks for your helpfull reply. Indeed, after disposing the buttons when closing the form it works as it should do.

Apparently , when closing without disposing, the buttons are no longer in the 'administration', as I can create them again with the same name and numbers, but they are still visible.

Anyhow, thanks,

Harry
 
Top