[Gambas-user] Question about Object.delete

ron ronstk at ...239...
Thu Apr 1 00:09:18 CEST 2004


On Wednesday 31 March 2004 22:25, Charlie Reinl wrote:
> Salut,
>
> if I create an Object, I can ask 'if Object = NULL then', but what is to
> do, to have the same state after 'Object.delete', because it is NOT NULL.
> (see snapshot)
> Like you can see on the snapshot the project does not make a lot.
> If the Object = NULL then it creates a TreeView and if it is <> NULL it
> deletes the Object.
> But if you have a seconde click on Button2 then you'v get an Error!
>
> Amicalement
> Charlie

Hi Charlie
I had it also in the past
in the declaration you use Object, and that has no .delete !

use for the variable in global section 
Public hFldTableView as TableView

and button1_click
hFldTableView = NEW TableView(Frame2) AS "FldTableView"
hFldTableView is a handle to it and the AS "FldTableView" is the name for it

--------------------
' Gambas class file

PUBLIC hFldTableView AS TableView

PUBLIC SUB Button1_Click()

IF hFldTableView=NULL THEN
  hFldTableView= NEW TableView(ME) AS "FldTableView"
  ENDIF
  hFldTableView.Move(0,0,50,50)
endif
END

PUBLIC SUB Button2_Click()
  IF hFldTableView<>NULL THEN
    hFldTableView.delete
    hFldTableView=NULL
  END IF  
END
-------------------------

I'm afraid you .delete the FldTableView as name and you want the object

I tested this and it works for me




More information about the User mailing list