INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Forms & Screen

How to return user generated properties from all open forms by mdav2
Posted: 12 Dec 01

You may, for error logging purposes want to retrieve the values of all the user defined properties on all your forms.  This is particulary useful in error logs as a memory dump will not show this information.  

I would like to thank Weedz for telling me about the pemstatus function.  


CODE
****

* This retrieves settings for all user generated form properties for all active forms
* The settings are stored in arrays that will be picked up by when a memeory dump is done

* Loop through all the (form) objects in the screens form collection
for each zoform in _screen.forms

    * Each for will have a different array created, this will be the name of the screen
    zcarrayname='z'+zoform.name

    * Create an array that holds all the forms properties
    = AMEMBERS(zgaproparray, zoform)

    * Calculate the array size, by looping through the property array and only including those that are user generated propereties
    znloop=0
    for each zelement in zgaproparray

        * Store the property name in single quotes
        zcpropname="'"+zelement+"'"

        * The pemstatus command checks the property on the form to see if its user generated
        * It requires 3 parameters
        * 1) The name of form
        * 2) The name of the property enclosed in quotes
        * 3) The user generated option (always 4)
        * EG, pemstatus(testform,'nOrderNo',4)
        if pemstatus(zoform,&zcpropname,4)=.t. then
            * Increment the loop counter used to dimension the array with the forms properties and values
            znloop=znloop+1
        endif    
    next zelement

    * Create an array that the values can be put into - this will be called the name of the form
    Public &zcarrayname(znloop,2)

    * Store the name and value in an array
    znloop=1
    for each zelement in zgaproparray

        zcpropname="'"+zelement+"'"
        
        if pemstatus(zoform,&zcpropname,4)=.t. then
            &zcarrayname(znloop,1)=zelement
            &zcarrayname(znloop,2)=zoform.&zelement
            znloop=znloop+1
        endif

    next zelement
    
    * Release all the variables used to create the arrays of form objects
    release zgaproparray
    release znloop
    release zcarrayname
    release zelement
    release zoform
    release zcpropname
    
next form

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close