Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deleted() in Grid
Message
From
02/02/2001 10:30:03
Charlie Schreiner
Myers and Stauffer Consulting
Topeka, Kansas, United States
 
 
To
01/02/2001 19:37:06
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00471551
Message ID:
00471751
Views:
19
Hi Dodi,

I think it may be fairly hard, but here's what I know. Grids have a Deleted() method, but when the method is running the delete (or recall) hasn't occurred yet--it's only going to occur after the method gets done. You would think you might do the delete in the method yourself, refresh the grid, then let nature take it's course. But that doesn't work because by the time the delete that you initiated by clicking on the DeleteMark occurs, the record has changed and you delete two records!
Here's a timer to refresh the Grid after the deleted() method runs. That way the delete (or recall) has already occurred. The simple way to say it is that when Deleted() fires, we know we must refresh the GRID, but we can't do it until after the Deleted method is done. NODEFAULT and RETURN .F. don't help. We must Refresh the grid afterwards, so a timer can be set to do the work.
IF NOT VARTYPE(_SCREEN.GridRefresher) = "O"
_SCREEN.NewObject('GridRefresher', 'GenericTimer', 'SomeFile')
ENDIF
_SCREEN.GridRefresher.Do("_SCREEN.ActiveForm.Page1.MyGrid", "Refresh()", 100)
**************************************************
*-- Class:        generictimer (c:\common\classes\handler.vcx)
*-- ParentClass:  tmrbase (c:\common\classes\msctrl.vcx)
*-- BaseClass:    timer
*-- Time Stamp:   01/18/2000 03:30:04 PM
*-- Pass the Do() method of this class an Object Name, Method Name, 
*-- and the interval to wait before executing the method. 
*-- If there is no code executing, this timer will cause the method to run.
*
DEFINE CLASS GenericTimer AS Timer
   Enabled = .F.
   Interval = 100
   *-- Object Name whose method to call when the Timer Event occurs.
   ObjectName = ""
   *-- Character. Name of the Method to call when the TimeOut Event occurs.
   MethodName = ""
   Name = "GenericTimer"

*-- This method starts the timer. Pass an object, 
*-- and the method to call. ie. Do(ThisApp, "Release()').
   PROCEDURE Do
   LPARAMETER ObjectName, MethodName, Interval
   ASSERT VARTYPE(m.ObjectName) = "C" AND NOT EMPTY(m.ObjectName) ;
      MESSAGE "You must pass the Object Name which contains the " ;
      + "Method you wish to call."
   ASSERT VARTYPE(m.MethodName) = "C" AND NOT EMPTY(m.MethodName) ;
      MESSAGE "You must pass the Method you wish to run when the " ;
      + "Timeout occurs."
   IF VARTYPE(m.Interval) = "N" AND NOT EMPTY(m.Interval)
	This.Interval = m.Interval
   ENDIF
      This.Reset()
      This.ObjectName = m.ObjectName
      This.MethodName = m.MethodName
      This.Enabled = .T.
   RETURN 
ENDPROC

*-- About this Class.
PROCEDURE ReadMe
#IF .F.
Use this object to call methods where the call stack can
get in the way of Release(), or similar situations.

Pass the full Object name (with it's hierarchy).
Pass the Method you wish to do.
If desired, pass the number of multiseconds to wait 
before running that method. Default is .1 secords, 
or you can change the interval prior to issuing Do().

Example:
oTimer = NEWOBJECT("GenericTimer", "Handler.VCX")
oTimer.Interval = 1000
oTimer.Do("_SCREEN.x", "SetFocus()")
or 
oTimer = NEWOBJECT("GenericTimer", "Handler.VCX")
oTimer.Do("ThisApp", "Release()", 100)
#ENDIF
ENDPROC


PROCEDURE Timer
   This.Enabled = .F.  && Shut down the Timer if we're ready to run 
                       && the designated method.
   RETURN EVALUATE(This.ObjectName + "." + This.MethodName)
ENDPROC

ENDDEFINE
>Hi...
>
>I have a grid in a form with DeleteMark = .T. and Deleted(). How may I hide the record after it's deleted by the user (that is, before the user clicks Save which updates the table)...?
Charlie
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform