Subject Re: form.close() not working
From Gaetano D. <gaetanoddRemoveThis@andThatHotmail.com>
Date Thu, 13 May 2021 19:02:49 +1000
Newsgroups dbase.getting-started

On 13/05/2021 14:18, AGOSTINHO wrote:
> Dear group.
> I'm having two issues with this form:
>
> 1. form.close() does not closes this form
> 2. I'm getting an error when run this form saying Error:  Variable undefined:  AG
>
> What i'm I doing wrong?
> Agostinho
>
> parameter bModal
> local f
> f = new test3Form()
> if (bModal)
>     f.mdi = false // ensure not MDI
>     f.readModal()
> else
>     f.open()
> endif
>
> class test3Form of FORM
>     with (this)
>        onOpen = class::FORM_ONOPEN
>        height = 16.0
>        left = 49.1111
>        top = 7.04
>        width = 40.0
>        text = ""
>     endwith
>
>     this.CUSTOMER1 = new QUERY(this)
>     with (this.CUSTOMER1)
>        left = 15.0
>        top = 6.0
>        sql = 'select * from "C:\Users\HOME_PC\Desktop\dBASEtutorial\customer.DBF"'
>        active = true
>     endwith
>
>     this.USERS1 = new QUERY(this)
>     with (this.USERS1)
>        left = 31.0
>        top = 6.0
>        sql = 'select * from "C:\USERS.DBF"'
>        active = true
>     endwith
>
>     this.PUSHBUTTON1 = new PUSHBUTTON(this)
>     with (this.PUSHBUTTON1)
>        onClose = class::PUSHBUTTON1_ONCLOSE
>        height = 1.92
>        left = 11.0
>        top = 10.56
>        width = 15.0
>        text = "CLOSE FORM"
>     endwith
>
>     this.PUSHBUTTON2 = new PUSHBUTTON(this)
>     with (this.PUSHBUTTON2)
>        onClick = class::PUSHBUTTON2_ONCLICK
>        height = 2.4
>        left = 11.0
>        top = 0.96
>        width = 20.0
>        text = "Pushbutton2"
>     endwith
>
>     this.rowset = this.customer1.rowset
>
>     function PUSHBUTTON1_onClose()
>        form.close()
>        return
>
>     function PUSHBUTTON2_onClick()
>            IF ag="AGOSTINHO"
>                 *say someting
>             ENDIF
>        return
>
>     function form_onOpen()
>        ag=form.users1.rowset.fields["NAAM"].VALUE
>        return
>
> endclass
>
>
Hi Agostinho,

It's not a good idea to put your data files in your root directory
("select * from c:\users.dbf"). I wouldn't do it even for testing. It is
advisable to use folders to store your data or programs because it just
makes sense to organize, backup, ....etc. Only system files should be in
the root directory "C:\"

--
Gaetano.