Subject Re: Simple parameter passing
From Bruce Beacham <bbeacham@no-plm-lowman.co.uk>
Date Wed, 28 Jan 2015 09:22:52 +0000
Newsgroups dbase.getting-started

On 28/01/2015 01:23, Randy Waldman wrote:
> Hi.  The mention of 'parameters' in Ken's book is overwhelming.  All
> I want to do is "call a form (from an onclick of a form) and pass a
> parameter to a sql on the 2nd form.
>
> Can someone shortcut the learning curve for me?

Try this.


Bruce Beacham


********************

if file("temp2.dbf")
    drop table "temp2.dbf"
endif
create table temp2 (cfield1 char(10), nfield1 integer, ;
    cfield2 char(10), cfield3 char(10))
insert into temp2 values ("Mr", 25, "Bruce", "Beacham")


local ff
ff = new form()
ff.pb1 = new pushbutton(ff)
ff.pb1.top = 5
ff.pb1.left = 10
ff.pb1.text = "Open"
ff.pb1.onClick = RunForm2
ff.open()




FUNCTION RunForm2

local f
f = new tgrform()
f.query1.sql = [select * from temp2]
f.query1.active = true
f.grid1.datalink = f.query1.rowset
f.open()

return

** END HEADER -- do not remove this line
//
// Generated on 28/01/2015
//
parameter bModal
local f
f = new tgrForm()
if (bModal)
    f.mdi = false // ensure not MDI
    f.readModal()
else
    f.open()
endif

class tgrForm of FORM
    with (this)
       height = 16.0
       left = 71.0
       top = 0.0
       width = 75.4286
       text = ""
    endwith

    this.QUERY1 = new QUERY(this)
    with (this.QUERY1)
       left = 28.0
       top = 1.0
       sql = "select * from temp"
    endwith

    this.GRID1 = new GRID(this)
    with (this.GRID1)
       onLeftMouseUp = class::GRID1_ONLEFTMOUSEUP
       dataLink = form.query1.rowset
       height = 7.0
       left = 6.0
       top = 4.5
       width = 47.0
    endwith


    function GRID1_onLeftMouseUp(flags, col, row)
       ? this.currentcolumn
       return

endclass


********************