[Gambas-user] Question about Object.delete

Rob sourceforge-raindog2 at ...94...
Thu Apr 1 01:12:31 CEST 2004


On Wednesday 31 March 2004 18:50, na2492 at ...9... wrote:
> >The Delete method destroy the control pointed by the Gambas
> > object, but it does NOT destroy the Gambas object itself, and
> > so the variable is not set to null.
> And what is to do in that case ?
> 'if Object = INVALID then' or what ?

Maybe declare a boolean variable and then do something like

mybool = TRUE
TRY mybool = (myobject = NULL) 
' if null, mybool is true, 
' if not null, mybool is false, 
' if invalid, mybool is true

IF mybool THEN
	' object either NULL or invalid, act accordingly
	...
ENDIF

If you need to differentiate between the NULL and invalid cases, 
you can always check the error object after the TRY line.

I think the interpreter probably needs an IsValid() builtin 
function, but in the meantime this should be an okay workaround.

Rob





More information about the User mailing list