* Try This Code...
MyForm=CREATEOBJECT("myform")
MyForm.show(1)
**************************************************
*-- Class: myform (c:\test\libs\test.vcx)
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 11/06/09 11:39:04 AM
*
DEFINE CLASS myform AS form
Top = 0
Left = 0
Height = 211
Width = 685
DoCreate = .T.
Caption = "Form"
Name = "myform"
ADD OBJECT grid1 AS grid WITH ;
Height = 121, ;
Left = 8, ;
Top = 8, ;
Width = 660, ;
Name = "Grid1"
ADD OBJECT text1 AS textbox WITH ;
Height = 25, ;
Left = 8, ;
Top = 140, ;
Width = 145, ;
Name = "Text1"
ADD OBJECT command1 AS commandbutton WITH ;
Top = 140, ;
Left = 176, ;
Height = 37, ;
Width = 121, ;
Caption = "Click Me", ;
Name = "Command1"
PROCEDURE command1.Click
**************************************
*Difference behavior from VFP6 to VFP9
**************************************
Close Tables All
Create Cursor MyData(C1 C(10),C2 C(10),C3 C(10),C4 C(10),C5 C(10))
Append Blank
Replace C1 With "C1",C2 With "C2",C3 With "C3",C4 With "C4",C5 With "C5"
*---------------------------------------------------------------------------------------------------
With Thisform
.grid1.RecordSource="MyData"
.grid1.SetAll("Enabled",.F.,"Textbox") && <=== Disable all TextBox in
Columns
.grid1.SetAll('DisabledBackColor',RGB(128,0,0),'textbox')
.grid1.SetAll('DisabledForeColor',RGB(0 ,0,0),'textbox')
*-------------------------------------------------------------------------------------------------------
.text1.SetFocus
.grid1.SetFocus
Wait "Test 1 ActiveColumn="+Transform(.grid1.ActiveColumn) Windows
Timeout 1 && ActiveColumn become 1
.text1.SetFocus
.grid1.SetFocus
Wait "Test 2 ActiveColumn="+Transform(.grid1.ActiveColumn) Windows
Timeout 1 && Why ActiveColumn become 5 ?
.text1.SetFocus
.grid1.SetFocus
Wait "Test 3 ActiveColumn="+Transform(.grid1.ActiveColumn) Windows
Timeout 1 && Why ActiveColumn become 4 ?
.text1.SetFocus
.grid1.SetFocus
Wait "Test 4 ActiveColumn="+Transform(.grid1.ActiveColumn) Windows
Timeout 1 && Why ActiveColumn become 3 ?
.text1.SetFocus
.grid1.SetFocus
Wait "Test 5 ActiveColumn="+Transform(.grid1.ActiveColumn) Windows
Timeout 1 && Why ActiveColumn become 2 ?
Endwith
Close Tables All
ENDPROC
ENDDEFINE
*
*-- EndDefine: myform
**************************************************
hth
-Stefan
I disable Text1 in all columns of grid to keep from user modify cell data
,only focus the cell allow.
Then user focus the cell and press F2 to open new fomr(or something else).
After user close the new form, grid cell get focus
again(".grid1.setfocus"),but not the same cell as before?
In VFP9, grid lost focus and get focus again, grid1.activecolumn does not
keep the same value as before lost focus.
VFP6 will keep the same value.
It's difference behavior from VFP6 to VFP9 but no reason.
"Stefan Wuebbe" <stefan...@gmx.de>
???????:e7j3gvrX...@TK2MSFTNGP04.phx.gbl...