Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid goto table's top record & show as top grid item
Message
De
29/07/2005 03:41:54
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01036855
Message ID:
01036858
Vues:
9
>I've always had this problem coding grids, so I thought it was time to learn a better way. How can you tell a grid to goto it's left-most column and top-record of the grid. I used doscroll(2) and (6) to scroll the grid by pages, but now knowing how many pages I would need, it's a hit & miss quess. What's the better way to do this. If I select a table with an index and say goto top, how do I get the grid to display the first row as the top record from the table? And, if the grid has a horizontal scrollbar, how to force the grid to display the left-most column as column1? Thanks for anyone who knows a better way!
>Jim Colombo.


Jim,

to set the focus to the left most column, I use this
&& grid.FirstEnabledColumn.SetFocus()

local FirstCol

FirstCol = this.GetFirstEnabledColumn()


do case
case isnull(FirstCol)
	=this.SetFocus()
otherwise
	=this.SetFocus()
	=FirstCol.SetFocus()
endcase

&&_____________________________________________
&& grid.GetFirstEnabledColumn()

** loop through columns

local _col, mincol, mincolorder, i

mincol = Null

for i = 1 to m.this.ColumnCount
	_col = m.this.Columns[m.i]
	
	do case
	case m._col.ReadOnly
	
	case !m._col.Enabled
	
	case !m._col.Visible
	
	case IsNull(m.mincol)
		mincol = m._col
		mincolorder = m._col.ColumnOrder
	
	case m._col.ColumnOrder >= m.MinColOrder
	
	otherwise
		Mincol = m._col
		Mincolorder = m._col.ColumnOrder
	
	endcase
endfor

return MinCol
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform