Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Row change in grid
Message
 
To
13/10/1997 14:29:21
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00054294
Message ID:
00054412
Views:
32
>When i did this, I had a problem with a new record. The Recno nummer returns -1
>I use table buffer 5, I also try the Activatecell() and the ActiveRow but that did not work either.
>If you have other suggestions, you are welcome.

You haven't to use ActivateCell() but you have to refresh the grid or to do a SetFocus(). Look at this code it's a basic pattern of my AfterRowColChange():

LOCAL lcRecordSource
lcRecordSource = THIS.RecordSource

LOCAL lnSaveRecNo
lnSaveRecNo = RECNO()

LOCAL lnPrevRecNo
lnPrevRecNo = THIS.xnRecNo && Record No saved in the BeforeRowColChange()

* IF I've CHANGED THE ROW
IF (lnSaveRecNo != lnPrevRecNo AND lnPrevRecNo != 0

* go on previous row
GO (lnPrevRecNo)

* is the input valid ?
IF (!THIS.xProcValidateRecord())

* VERY IMPORTANT LOOK AT THE MANAGEMENT OF THE FOCUS AND DON'T CHANGE IT
* OTHERWISE YOU'LL HAVE A SELECT PROBLEM

* GO on ERROR record
THISFORM.LockScreen = .T.
THIS.Parent.cmdFocusControl.SetFocus() && Focus to external control

GO (lnPrevRecNo) IN &lcRecordSource

THIS.SetFocus()
THISFORM.LockScreen = .F.
ELSE
* Go on the new record
THISFORM.LockScreen = .T.
THIS.Parent.cmdFocusControl.SetFocus() && Focus to external control

GO (lnNewRecNo) IN &lcRecordSource

THIS.SetFocus()
THISFORM.LockScreen = .F.
ENDIF
ENDIF


IF lnNewRecNo != lnPrevRecNo

&& Generate my row changed event
THIS.xProcOnRowChange(lnNewRecNo)
ENDIF

If you have to activate a particular cell you can do this operation

GO (nRecordToActivate)
grid.ActivateCell( grid.RelativeRow, grid.column2activate.ColumnOrder - ;
(grid.ActiveColumn - grid.RelativeColumn))

Hope to have help you,
Renato Bertuol (EMail:renato.bertuol@elmec.it
Homepage:www.geocities.com/SiliconValley/Horizon/3216)
Elmec Informatica (URL www.elmec.it)
Previous
Reply
Map
View

Click here to load this message in the networking platform