Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multi-functional textbox
Message
 
 
To
23/06/2000 11:59:08
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00383562
Message ID:
00383918
Views:
14
>Nadya:
>
>Use AFIELDS() and columns 2 - DataType, 3 - Field Width, 4 - decimal places.
>
>Daniel

Hi Daniel,

This is the code, I finally came out. It tested only for Character types, though.
********************************************************************
*  Description.......: TargetFld.InteractiveChange()
*  Calling Samples...:
*  Parameter List....:
*  Created by........: Nadya Nosonovsky 06/23/2000 10:30:34 AM
*  Modified by.......: Nadya Nosonovsky 06/23/2000 12:52:23 PM
********************************************************************
local lcType, lnSize, lnElement, lnFound, lnDigits
lcField=alltrim(this.value) && Field Name
lnFound=ascan(thisform.abldmflds,lcField) && Search for this field
lnElement=asubscript(thisform.abldmflds,lnFound,1)
thisform.cFieldType=thisform.abldmflds[lnElement, 2] && The type of the field
lcType = thisform.cFieldType
lnSize= thisform.abldmflds[lnElement, 3] && Field size
lnDigits= thisform.abldmflds[lnElement, 4] && Decimal places

if thisform.globOPt.value=1 && Replace with constant
     with thisform.ReplaceVal
          do case
          case lcType = "C"
               .format=''
               .inputmask=''
               .value = ""
               .format='R'
               .inputmask=replicate('X',lnSize)

          case lcType $ "NFIY"
               .format=''
               .inputmask=''
               .value = 0
               if lcType='Y' && currency
                    .format='$'
               endif
               if lcType='N'
                    if lnDigits>0
                         .inputmask=replicate('9',lnSize-lnDigits-1)+'.'+replicate('9',lnDigits)
                    else
                         .inputmask=replicate('9',lnSize)
                    endif
               endif

          case lcType = "D" && Date
               .format=''
               .inputmask=''
               .value = {}
               .format='YL'

          case lcType = "T" && Datetime
               .format=''
               .inputmask=''
               .value = ctot('')
               .format='YL'

          case lcType = "L"
               .format=''
               .inputmask=''
               .value = .f.

          case lcType='M' && Memo
               .format=''
               .inputmask=''
               .value = ""
          endcase
          .SetFocus()
     endwith     
endif
if thisform.globOPt.value=2 && Replace with field
   thisform.ReplaceFld.SetFocus()
endif
Thanks again all of you for assistance.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform