Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validating Data In A Grid Problem.
Message
From
05/02/2002 13:42:39
Mike Sue-Ping
Cambridge, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00615529
Message ID:
00615650
Views:
21
Mark,

Thanks for the code snippet.

When I used it into my grid and ran my form, the gridrowchange() is called in the AfterRowColChange() event which means that the row has been already exited and the validation fires too late. Did I do something wrong?

I need the validation to fire when the user attempts to leave the current row/record but don't actually leave the row/record unless the validation returns true. If it returns false I will show a file open dialog.

Mike.

>Code from my grid class that detects when the row changes:
>DEFINE CLASS gridcontrol AS grid
>
>   *-- used to determine if the active grid row has changed
>   *-- in the Before and AfterRowColChange methods
>   oldactiverow = 1
>
>   Name = "gridcontrol"
>
>   PROCEDURE Init
>      if !empty(This.RecordSource) and reccount(This.RecordSource) <> 0
>         This.OldActiveRow = RecNo()
>      else
>         This.OldActiveRow = 0
>      endif
>   ENDPROC
>   PROCEDURE BeforeRowColChange
>      LPARAMETERS nColIndex
>      if !empty(This.RecordSource) and reccount(This.RecordSource) <> 0
>         This.OldActiveRow = RecNo(This.RecordSource)
>      else
>         This.OldActiveRow = 0
>      endif
>   ENDPROC
>   PROCEDURE AfterRowColChange
>      LPARAMETERS nColIndex
>      if !empty(This.RecordSource) and reccount(This.RecordSource) <> 0
>         if This.OldActiveRow <> RecNo(This.RecordSource)
>            This.GridRowChange()
>            ThisForm.Refresh()
>         endif
>      endif
>   ENDPROC
>   *-- method to place additional code to be called by
>   *-- AfterRowColChange only if the Row changed
>   PROCEDURE gridrowchange
>       *-- put your row change code here
>
>   ENDPROC
>ENDDEFINE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform