Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error - Record Source of a Browse Object in Grid Builder
Message
De
28/02/2003 07:47:16
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Error - Record Source of a Browse Object in Grid Builder
Divers
Thread ID:
00759323
Message ID:
00759323
Vues:
68
I am writting a grid builder.

I want to build the grid using custom classes for columns and headers. (VFP7 SP1)

Since this cannot be done visually I have written a program based class. See below.

When I run the builder I get the error message :

"You may not change the Record Source of a Browse Object"

At the line ".AddObject(cColumn,"cusColumn")"

The error makes no sense to me. I set the Record source of the Grid to blank.

Adding the headers later in the builder works fine using similar logic.

Any help?
* * GridCusClass.prg - custom classes for headers and columns
define class cusHeader as header
	name = 'cusHeader'
	proc Click
		if this.Parent.lReSized && column
			this.Parent.lReSized = .f.
		else
			* Tell the grid this header was clicked
			= this.Parent.Parent.HeaderClick(This) && Grid
		endif
	endproc
enddefine

define class cusColumn as column
	lresized = .f.
	name = 'cusColumn'
	proc Resize
		* Tell the header this column was resized
		this.lReSized = .t.
	endproc
enddefine
Builder code looks like the following :
set procedure to GridCusClass.prg additive
* other initalization not shown

* * clear grid - delete all existing columns
for nCol = 1 to oGrid.ColumnCount
	oGrid.DeleteColumn()
endfor
** set grid properties
* not shown ..
* * get the DE
= aselobj(aAns,2)
oDE = aAns[1]
oGrid.RecordSource     = ""
if oGrid.RecordSourceType # 1
	oGrid.RecordSourceType = 1 && alias
endif
** add columns
* * change columns to cusColumn
local cColumn,nFieldNo,cCusControl,oControl,nPos,cClassLib
for nCol = 1 to nNoCols
	with oGrid
		cColumn = "Column" + alltrim(str(nCol))
		.AddObject(cColumn,"cusColumn") && at this point I get the error
	endwith
endfor
oGrid.RecordSource = oDE.Cursor1.Alias
Best Regards
Don Simpson
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform