check, if button exists

BlitzPlus Forums/BlitzPlus Programming/check, if button exists

Dirk Knoop(Posted 2003) [#1]
I ant to check, if a created button is still there or was FreeGadget.
If the button does not exists, the programm should create a new one.

I do it so:

Code:

If button_Besteposition1<>0 Then FreeGadget button_Besteposition1:button_Besteposition1=0

button_Besteposition1=CreateButton("RV",10,5,50,15,panelbesteposition,3)



Sometimes, if the If..Then-Code is checked, the programm ends with the message "Invalid Gadget Handle".

Why is that so?

How can I check, if the button does still exists ?

Kind Regards,

Dirk Knoop


soja(Posted 2003) [#2]
The code works fine for me... is that all you're doing with the button?

Though I'm curious as to why you would want to do this? Would it be better to use something like HideGadget and ShowGadget?