Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Textbox VALID not firing?
Message
 
 
À
08/03/2000 05:02:04
Jill Derickson
Software Specialties
Saipan, CNMI
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00341975
Message ID:
00343259
Vues:
24
Jill,

>I remember there being some problem using the Default property set to .T. on a button....I'm not sure if that could be related to your problem or not...did

Yes, this was a huge problem and the only solution, which I finally came up, was to put in textbox KeyPress method this code: (and eliminate Valid code)
********************************************************************
*  Description.......: Text1.KeyPress
*  Calling Samples...: 
*  Parameter List....: nKeyCode, nShiftAltCtrl
*  Created by........: Nadya Nosonovsky 03/07/2000 03:20:36 PM 
*  Modified by.......: Nadya Nosonovsky 03/07/2000 05:34:44 PM
********************************************************************
LPARAMETERS nKeyCode, nShiftAltCtrl
local lcValue
lcValue=alltrim(this.value)
if nKeyCode=13 && Enter
   with this.parent.parent && Btcc_list
        .Validate(lcValue)
        if .AllowAdd
          .Container1.AddRemove1.cmdAdd.Click()   
        endif
   endwith
   nodefault      
endif
The similar code in Valid event didn't work, as I wanted...

you convince yourself that returning a .F. from a Valid will not let you out, even w/mouse actions? J

Yes, I tested this and convinced myself. Thanks.


>>Jill,
>>
>>I'm really messed up :( I have a class, which allows me to add values, if they are not duplicates. This is exactly what I have in textbox.valid method:
>>
>>
>>********************************************************************
>>*  Description.......: Text1.Valid
>>*  Calling Samples...:
>>*  Parameter List....:
>>*  Created by........: Nadya Nosonovsky 03/07/2000 03:20:36 PM
>>*  Modified by.......: Nadya Nosonovsky 03/07/2000 04:57:47 PM
>>********************************************************************
>>local lcValue
>>lcValue=alltrim(this.value)
>>with this.parent.parent
>>     .AllowAdd=.f.
>>     .Validate(lcValue)
>>   if .AllowAdd
>>     .AddValue(lcValue)
>>     this.parent.list1.Requery()
>>     this.value=''
>>   endif
>>endwith
>>return this.parent.parent.AllowAdd
>>
>>
>>The problem is that I have Ok button on the form with Default property set to .T.
>>So, each time, I hit Enter, this form finishes it's work. I tried NoDefault in KeyPress, but now it doesn't work the way I want.
>>
>>>That is exactly my situation...the system is a reservation system and I want to get the number of reservations before anything else happens...I could do this in a number of ways, of course, but right now I'm using a textbox on the form that checks the value and does not allow focus to leave the textbox until they enter a valid value - except if they ESCAPE out. They can't click on a combo, or anything else, except CANCEL button.
>>>
>>>J
>>>
>>>> My point actually was, that even if the control TabOrder is 1 on the form and this control has something in Valid method, we still can leave this control and go to another with mouse. Right now, however, I'm not so sure in this statement, so I need to make additional testing. At least, I noticed this behavior in some of my classes...
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform