Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Grid in VFP6 work just fine but in VFP9 make me crazy.....

170 views
Skip to first unread message

fr...@hi-square.com.tw

unread,
Nov 5, 2009, 11:14:24 PM11/5/09
to
*----------------------------------------------------------------------------
* Grid in VFP6 work just fine but in VFP9 make me crazy.....
*
* Thousand of code have to modify in my project.
*
* Any advice will be appreciated?
*----------------------------------------------------------------------------


* 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
**************************************************


Stefan Wuebbe

unread,
Nov 6, 2009, 3:34:03 AM11/6/09
to

Does Grid.AllowCellSelection=.F. do what you want in Vfp9?


hth
-Stefan

fred

unread,
Nov 8, 2009, 9:15:03 PM11/8/09
to

Hi 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...

0 new messages