Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subclassing grid
Message
De
03/04/1999 10:37:36
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00204932
Message ID:
00204938
Vues:
17
Hola Esteban ---

Grids don't subclass in code very well. I think your problem may be more related to how you are instancing the Grid rather than in the code itself. How are you using your Grid class?


>Hi all,
>I'm trying to sibclassing a grid columns.
>I'll like to use a custom Header and a custom textbox
>My code look like this:
>
>
Define Class tateHeader As Header
>	FontSize = 8
>	FontName = "Arial"
>	Alignment = 2
>	Procedure Click
>		This.parent.parent.SortGrid(This.parent.ColumnOrder)
>		This.parent.parent.SetAll( "FontBold", .F., "tateHeader" )
>		This.FontBold = .T.
>	EndProc
>EndDefine
>
>Define Class tateColumn As Column
>	Procedure Init
>		Set ClassLib To ..\shared\libs\autoABM Additive
>		With This
>			.RemoveObject( "header1" )
>			.AddObject( "Header1", "tateHeader" )
>			.RemoveObject( "Text1" )
>			.AddObject( "txtDato", "browseTextBox" )
>			.CurrentControl = "txtDato"
>			.Sparse = .F.
>			.Bound = .F.
>		EndWith
>	EndProc
>	
>	Procedure ControlSource_Assign
>		LParameter uNewVal
>		This.txtDato.ControlSource = uNewVal
>		This.ControlSource = uNewVal
>	EndProc
>EndDefine
>
>At the form init:
>
>
With Thisform
>	.LockScreen = .T.
>	cSQL = 'Select ' + .abmCampos + ' From ' + .abmTablas + ' Where ' + .abmCondicion + ' Order By '+ AllTrim(Str(.abmOrden))+' '+ .abmTipoOrden + ' Into Cursor cur'+.Name
>	&cSQL
>	With .grdBrowse
>		.RecordSourceType = 1
>		.RecordSource = 'cur'+.Name
>	EndWith
>	.CreateColumns()
>	.LockScreen = .F.
>	.grdBrowse.SetFocus()
>EndWith
>At form CreateColumns method:
>
Dimension aCampos[This.abmColumnas,2]
>With This
>	For i = 1 To .abmColumnas
>		aCampos[i,1] = .grdBrowse.Columns[i].ControlSource
>		aCampos[i,2] = .grdBrowse.Columns[i].Width
>	EndFor
>
>	.grdBrowse.ColumnCount = 0
>	For i = 1 To .abmColumnas-1
>		lcObject = "Column"+Trans(i)
>		nPrim  = Iif( i=1, 1, Atc( ";", .abmColumnTitles, i-1 )+1 )
>		nCuan  = Atc( ";", .abmColumnTitles, i ) - nPrim
>		cTitu = SubStr( .abmColumnTitles, nPrim, nCuan )
>		With .grdBrowse
>			.AddObject(lcObject,"tateColumn")
>			.&lcObject..ControlSource = aCampos[i,1]
>			.&lcObject..Width = aCampos[i,2]
>			.&lcObject..Header1.Caption = cTitu
>			.&lcObject..Refresh()
>		EndWith
>	EndFor
>	cTitu = SubStr( This.abmColumnTitles, Rat( ";", This.abmColumnTitles ) + 1 )
>	lcObject = "Column"+Trans(i)
>	With .grdBrowse
>		.AddObject(lcObject,"tateColumn")
>		.&lcObject..ControlSource = aCampos[i,1]
>		.&lcObject..Width = aCampos[i,2]
>		.&lcObject..Header1.Caption = cTitu
>		.&lcObject..Refresh()
>	EndWith
>	.grdBrowse.Refresh()
>EndWith
>
>The problem is that NO DATA ARE SHOWED IN BOTH RECORDS AND HEADER
>
>What is missing?? Please Help me!
>Thanks in advance!!!!
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform