Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Up/Down Keys Inside Container/Class in Grid

Status
Not open for further replies.

Auguy

Programmer
May 1, 2004
1,206
US
I have a container (Class) with a textbox for a date and a spinner to move the date up or down a day at a time. The spinner has the tabstop set to false. When this class is in a grid and has the focus, pressing the up or down arrow makes it act like the tab or shift-tab keys were pressed and the focus shifts to the previous or next column, not the previous or next record. Is there a way to fix this?

Auguy
Northwest Ohio
 
I too would be interested in the answer to this quetsion. I have been using a grid on a pageframe for sometime now and have resorted to putting a command button with skip routines in it. Cannot figure out how to get the up,down,home, and end keys to work with the grid.

This old world keeps spinning round - It's a wonder tall trees ain't layin' down
 
You could try trapping the keys via the grid's KeyPress event. If you see the up or down arrow, move the record pointer to the previous or next record. You would then set focus on the grid to make the change in the highlight visible.

I haven't tried it, but it might be worth a shot.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike, I've thought about that and was trying to avoid it. Also thinking about setting the current control to Text1 (default textbox) which is still in the column because I'm using Dynamic Current Control with Sparse set to true. Then I could issue a keyboard comand for the up/down arrow for Text1. I will test when I get a minute or two.

Auguy
Northwest Ohio
 
This code seems to work pretty good in the keypress event of the textbox within the container.
Code:
Lparameters nKeyCode, nShiftAltCtrl

Do Case
Case nShiftAltCtrl = 0 And nKeyCode = 5
	Thisform.LockScreen = .T.
	This.Parent.Parent.CurrentControl = 'Text1'
	Keyboard "{UPARROW}" + "{TAB}" Plain Clear
	Thisform.LockScreen = .F.
Case nShiftAltCtrl = 0 And nKeyCode = 24
	Thisform.LockScreen = .T.
	This.Parent.Parent.CurrentControl = 'Text1'
	Keyboard "{DNARROW}" + "{BACKTAB}" Plain Clear
	Thisform.LockScreen = .F.
Otherwise
	DoDefault(nKeyCode, nShiftAltCtrl)
Endcase
It does cause problems (loop) if it is the only column in the grid that is enabled. This doesn't happen too often, so maybe I can program around it. The grid still flashes at times too??

Auguy
Northwest Ohio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top