Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Set focus in grid
Message
From
30/07/2003 09:44:34
 
 
To
30/07/2003 09:26:45
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00814884
Message ID:
00814898
Views:
9
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform