| Subject |
Re: Derive grid's fieldName |
| From |
Akshat Kapoor <akshat.kapoor@kapoorsons.in> |
| Date |
Mon, 25 Oct 2021 13:01:45 +0530 |
| Newsgroups |
dbase.getting-started |
| Attachment(s) |
test_grid.wfm |
Good Afternoon Ken, Andy,
> Akshat almost had it with form.grdList.columns["Column1"].datalink but that, as he points out, is seen by dBASE an object reference
> rather than a string. I investigated and found that it actually points to the fields object in the rowset, so the following is what you need:
>
> ? form.grdList.columns["Column1"].datalink.fieldname
>
> Your next task will be how to find the column number when the user clicks on a particular cell in the grid...
> It's late in the UK so I'm off to bed. :-)
It was a narrow miss but still a miss.
I am more surprised to the reason why I am getting variable not defined
error in test_grid.wfm
The columns have not been defined but the grid is still displaying data.
So it is arranging data into columns.
So the columns array must be there.
Regards
Akshat
|
** END HEADER -- do not remove this line
//
// Generated on 24.10.2021
//
parameter bModal
local f
f = new test_gridForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class test_gridForm of FORM
with (this)
onOpen = class::FORM_ONOPEN
height = 24.4545
left = 4.7143
top = 0.0
width = 146.7143
text = ""
endwith
this.DBASESAMPLES1 = new DATABASE(this)
with (this.DBASESAMPLES1)
left = 66.0
top = 3.0
width = 11.0
height = 1.0
databaseName = "DBASESAMPLES"
active = true
endwith
this.CUSTOMERS1 = new QUERY(this)
with (this.CUSTOMERS1)
left = 52.0
top = 2.0
width = 9.0
height = 1.0
database = form.dbasesamples1
sql = "select * from CUSTOMERS.DBF where customerid<35"
active = true
endwith
this.GRID1 = new GRID(this)
with (this.GRID1)
dataLink = form.customers1.rowset
height = 7.5
left = 10.0
top = 5.5
width = 133.0
endwith
this.rowset = this.customers1.rowset
function form_onOpen()
?form.grid1.columncount
?form.grid1.columns["Column1"].datalink
inspect(form)
return
endclass
|