Gene Wirchenko wrote on 2013-09-25:
> Dear Vixens and Reynards:
> By default, a grid has controls in each column: a header and a
> data control.
> I want my own data controls. (I want to be able to clean up
> data and to validate it.)
> I have been able to do this, but the way that I am using smells
> of kludge. Here is a snippet:
> this.column1.controlsource="testdata.datakey"
> this.column1.header1.caption="PK"
> this.column1.removeobject(this.column1.controls(2).name)
> this.column1.addobject("col1","newtextbox","testdata.datakey",;
> "isalpha(substr(this.value,1,1)) and "+;
> "isalpha(substr(this.value,2,1)) and
isalpha(substr(this.value,3,1))")
> Having to .removeobject() with a fixed control number strikes me as
> being two kludges. Is there a way to set up a grid without having to
> deal with a data control automatically being added for each column?
>
> Sincerely,
>
> Gene Wirchenko
>
Gene,
Look at the MemberClass and MemberClassLibrary of the grid to use your
subclass of Column.
On the Column will ADD OBJECT what you want, you can define the HeaderClass
and HeaderClassLibrary
Tracy Pearson
PowerChurch Software
LOCAL loForm
loForm = CREATEOBJECT("testform")
loForm.AddObject("grd", "grd")
loForm.grd.visible = .T.
loForm.Show(1)
RELEASE loForm
CLEAR CLASS "testform"
DEFINE CLASS testform as Form
width = 400
height = 400
datasession = 2
PROCEDURE load
CREATE CURSOR testdata ( ;
ikey i, ;
cone c(10), ;
itwo i)
INDEX ON ikey TAG ikey
INDEX on itwo TAG itwo
INSERT INTO testdata ;
VALUES (1, "one", 1)
INSERT INTO testdata ;
VALUES (2, "three", 3)
INSERT INTO testdata ;
VALUES (3, "two", 2)
ENDPROC
ENDDEFINE
DEFINE CLASS grd as grid
top = 10
left = 10
width = 380
height = 380
rowsource = "testdata"
rowsourcetype = 1
anchor = 15
AllowCellSelection = .F.
recordmark = .f.
deletemark = .f.
splitbar = .f.
memberclasslibrary = "prggridform.prg"
memberclass = "clm"
*-- It is important to set this AFTER memberclass*
columncount = 2
PROCEDURE init
this.clm1.controlsource = "testdata.cone"
this.clm1.header1.caption = "One"
this.clm2.controlsource = "testdata.itwo"
this.clm2.header1.caption = "Two"
ENDPROC
PROCEDURE DblClick
ThisForm.Release()
ENDPROC
ENDDEFINE
DEFINE CLASS clm as Column
ADD OBJECT txt as txt
sparse = .F.
ENDDEFINE
DEFINE CLASS txt as TextBox
forecolor = RGB(255,0,255)
ENDDEFINE
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.