Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Set focus in grid
Message
De
30/07/2003 09:44:34
 
 
À
30/07/2003 09:26:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00814884
Message ID:
00814898
Vues:
10
This message has been marked as the solution to the initial question of the thread.
>Who can help me?
>I have a grid (recordsource is cursor 'income1').
>On the right column I added the following lines in the 'keypress' event:
LPARAMETERS nKeyCode, nShiftAltCtrl
>if nkeycode=24
>select income1
>	append blank
>This.Parent.Parent.Column1.combo1.setfocus
>endif
>I want the user will get the focus of the next line by pressing on the arrowdown key (number 46), every thing is good, but the user getting the focus on the right column, how can I give him focus on the left column?
>(As you can see I used with set fucus, but it's not working).
>
>Thanks in advance

Chaim,

This may help
&& Form.Keypress
LPARAMETERS nKeyCode, nShiftAltCtrl

if nkeycode=24
    NODEFAULT
    select income1
    append blank
    =this.YourGridName.Refresh() && or this.Refresh()
    =this.YourGridName.FirstEnabledColumn_SetFocus()
endif

&& add this to your grid class
&& method: FirstEnabledColumn_SetFocus()

local FirstCol

FirstCol = this.GetFirstEnabledColumn()


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

&& method: GetFirstEnabledColumn()

** loop through columns

local _col, mincol, mincolorder, i

mincol = Null

for i = 1 to this.ColumnCount
	_col = this.Columns[i]
	if( !_col.ReadOnly and _col.Enabled and _col.Visible )
		if( IsNull(mincol) )
			mincol = _col
			mincolorder = _col.ColumnOrder
		else
			if( _col.ColumnOrder < MinColOrder )
				Mincol = _col
				Mincolorder = _col.ColumnOrder
			endif
		endif
	endif
endfor

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

Click here to load this message in the networking platform