Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Anil Tayal
  Where is Anil Tayal?
 Delhi
 India
 Anil Tayal
 To: Terrence Ho
  Where is Terrence Ho?
 Hong Kong
 Hong Kong
 Terrence Ho
 Tags
Subject: RE: How to eliminate the Return Value from Vali...
Thread ID: 16112 Message ID: 16153 # Views: 1 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Thursday, October 10, 2002 6:23:06 AM         
   


> > > > > > Hi,
> > > > > >
> > > > > > In my Program, I have a Valid Event that vervify something then return a .F. value, so the foucs can not leave the control, but there is a problem that if I instantly press Save or Cancel Button, it will return to un-editing environment, but the RETUN .F. from Valid Event is still working, I can not add a new record because the the Valid Event instancely looping.
> > > > > >
> > > > > > Could any tell me how can I eliminate the RETURN .F. from the Valid Event??
> > > > > >
> > > > > > Thanks in advance
> > > > > >
> > > > > > Terrence
> > > > >
> > > > > Hi,
> > > > > If you are trying to ask how do you break out of a valid event on a form, have the valid event set up
> > > > > with a memory variable to control it.
> > > > > Assign a memory variable named lNoValidation=.F.
> > > > >
> > > > > The Valid Event code:
> > > > >
> > > > > IF lNoValidation=.F.
> > > > >
> > > > > If this.value=" "
> > > > > Return .F.
> > > > > ELSE
> > > > > Return .T.
> > > > > Endif
> > > > >
> > > > > ELSE
> > > > >
> > > > > Return .T.
> > > > > ENDIF
> > > > >
> > > > > On the mouse move event of your Cancel/Exit button set the value of lNoValidation=.T.
> > > > > Now when you click the Cancel command button the validation test will return .T. and
> > > > > let you out of the fields validation events.
> > > > >
> > > > > Hope this is what you wanted to know ?
> > > > >
> > > > > Pete from the Great White North ! (Only in Canada, ay...) Over and Out ...
> > > >
> > > > Pete,
> > > >
> > > > That a good idea, but I have to set back the value lNoValidation=.F. on Add or Edit Button, the problem still exist, because the Valid Event still internally working.
> > > >
> > > > Terrence
> > >
> > > Why don't you check for the state of the control? You mentioned an editing and non-editing environments. You must be setting something readonly or maybe setting the enabled property to .F. to accomplish that. Why not check the state of that property and then use Pete's idea that way?
> > >
> > > ---
> > >
> > > www.foxite.com - The Home of the Visual FoxPro Experts
> >
> >
> >
> > Hi Terrence.....
> >
> > Possibly I am misunderstanding what you are trying to do... ?
> > If you use what I described above you will breakout of the valid event of the
> > field you cursor is currently sitting in. When you press the Cancel button as
> > an example, this command button sets the controlling memory variable back
> > to .t.
> > I think what you are saying you are able to say click on the save button
> > although a valid field method is still active. Save takes you out of edit mode
> > and you set all your inputs to enabled=.f. (non-edit environment), but the
> > valid event is still active. Confirm to Michael and me if this is the story??
> >
> > Pete from the Great White North ! (Only in Canada, ay...) Over and Out ...
>
>
> Pete,
>
> Exactly, I have a Form that have a few TextBox and a Grid with a ComboBox inside, all are controlling by some buttons, as follow :
> Add Button - append blank and get into editing mode
> Edit Button - get into editing mode
> Cancel Button - abandon all input and get back into non-editing mode
> Save Button - save all input and get back into non-editing mode
> :
> Now, the problem is that, when editing mode, the Valid Event form Grid Combo returns me .F. (also a messagebox("error") was defined as well), when the focus still sitting on that control and the Valid Event still waiting my correct input, I instantly press Cancel or Save Button, it will get back to non-editing mode. Then, I press Add or Edit Button, I found that the valid event still active, I can not focus to any control, the messagebox("error") I defined prompted every time I clicked on a control.
>
> How can I eliminate the Valid return value before I press the Add or Edit Buttons?
>
> Thanks
>
> Terrence

Hi, I am no expert but I think I have many such forms and they operate without any problem. I use two form variables isAdding and isEditing. When I add I set both the varables to .T. When only editing the adding variable remains .F. The save or cancel button sets both the variables to .F. All the controls on the form check for the status of the isEditing variable in their WHEN event and dont allow changes when isEditing is .F. Using this method each of your controls know what exactly are you doing. You can make your valid events dependent upon these variables. Hope this helps..

Anil


ENTIRE THREAD

How to eliminate the Return Value from Valid Event Posted by Terrence Ho @ 10/9/2002 11:32:22 AM
RE: How to eliminate the Return Value from Vali... Posted by Pete Sass @ 10/9/2002 2:06:26 PM
RE: How to eliminate the Return Value from Vali... Posted by Terrence Ho @ 10/9/2002 3:33:02 PM
RE: How to eliminate the Return Value from Vali... Posted by Michael Gill @ 10/9/2002 9:18:16 PM
RE: How to eliminate the Return Value from Vali... Posted by Pete Sass @ 10/9/2002 10:25:08 PM
RE: How to eliminate the Return Value from Vali... Posted by Terrence Ho @ 10/10/2002 12:09:29 AM
RE: How to eliminate the Return Value from Vali... Posted by aktayal @ 10/10/2002 6:23:06 AM
RE: How to eliminate the Return Value from Vali... Posted by Pete Sass @ 10/10/2002 1:18:42 PM
RE: How to eliminate the Return Value from Vali... Posted by Travis Pick @ 10/10/2002 3:14:05 PM
RE: How to eliminate the Return Value from Vali... Posted by Terrence Ho @ 10/10/2002 4:20:12 PM
RE: How to eliminate the Return Value from Vali... Posted by RENE RELUCIO @ 10/11/2002 2:24:36 PM
RE: How to eliminate the Return Value from Vali... Posted by Rene Relucio @ 10/13/2002 12:20:41 PM
THANKS EVERYBODY Posted by Terrence Ho @ 10/15/2002 7:35:46 PM