| Subject |
Re: replace command |
| From |
Mervyn Bick <invalid@invalid.invalid> |
| Date |
Sat, 1 May 2021 17:44:48 +0200 |
| Newsgroups |
dbase.getting-started |
| Attachment(s) |
ef_on_container.wfm |
On 2021/05/01 11:40, Gaetano D. wrote:
> I just tried an entryfield inside a container object, and it does
> understand "form.rowset". I am lost now... I thought that direct
> parenthood was the dividing line... but obviously not. Since "this"
> means the entryfield in the entryfield's onChange event, and this.parent
> is the container, how does this entryfield inside the container know
> about the form object?
I can't replicate this.
In the attached example the entryfield's onChange event handler has no
problem writing to the form's rowset.
Mervyn.
| if file('ef_on_container.dbf')
drop table ef_on_container
endif
if not file('ef_on_container.dbf')
create table ef_on_container (id autoinc,data numeric(10,2))
insert into ef_on_container (data) values (12.34)
endif
** END HEADER -- do not remove this line
//
// Generated on 2021-05-01
//
parameter bModal
local f
f = new ef_on_containerForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class ef_on_containerForm of FORM
with (this)
height = 19.6364
left = 17.8571
top = -0.0455
width = 40.0
text = ""
endwith
this.EF_ON_CONTAINER1 = new QUERY(this)
with (this.EF_ON_CONTAINER1)
left = 1.0
width = 13.0
height = 1.0
sql = 'select * from "D:\Examples\Plus2019\ef_on_container.DBF"'
active = true
endwith
this.CONTAINER1 = new CONTAINER(this)
with (this.CONTAINER1)
left = 4.5714
top = 1.5
width = 28.4286
height = 5.7273
endwith
this.CONTAINER1.ENTRYFIELD1 = new ENTRYFIELD(this.CONTAINER1)
with (this.CONTAINER1.ENTRYFIELD1)
onChange = class::ENTRYFIELD1_ONCHANGE
height = 1.0
left = 7.1429
top = 2.0455
width = 14.5714
value = "Entryfield1"
pageno = 0
endwith
this.PUSHBUTTON1 = new PUSHBUTTON(this)
with (this.PUSHBUTTON1)
onClick = class::PUSHBUTTON1_ONCLICK
height = 1.0909
left = 11.7143
top = 16.2727
width = 15.2857
text = "Change EF value"
endwith
this.GRID1 = new GRID(this)
with (this.GRID1)
dataLink = form.ef_on_container1.rowset
height = 4.0
left = 4.2857
top = 8.0
width = 28.7143
endwith
this.PUSHBUTTON2 = new PUSHBUTTON(this)
with (this.PUSHBUTTON2)
onClick = class::PUSHBUTTON2_ONCLICK
enabled = false
height = 1.0909
left = 11.7143
top = 17.5909
width = 15.2857
text = "Save to .dbf"
endwith
this.TEXT1 = new TEXT(this)
with (this.TEXT1)
height = 3.0
left = 6.2857
top = 12.4545
width = 28.4286
text = "Click top pushbutton and then click the bottom pushbutton. Then enter a value in the entryfield and press TAB"
endwith
this.rowset = this.ef_on_container1.rowset
function ENTRYFIELD1_onChange()
form.rowset.fields['data'].value = this.value
form.rowset.save()
return
function PUSHBUTTON1_onClick()
form.container1.entryfield1.value = 123.45
form.pushbutton2.enabled = true
return
function PUSHBUTTON2_onClick()
form.container1.entryfield1.onChange()
return
endclass
|
|