Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting Database Property for form level?
Message
From
13/07/2006 04:03:05
 
 
To
13/07/2006 02:29:30
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01135422
Message ID:
01135941
Views:
22
>>You can avoid the macro substitution here:
>
>This is cool !!!
>That getpem trick actually hands me back object reference :))
>
>BTW this was million years old code, dating way back to my
>VFP exploration time. Never gave me any problem so I never
>tought of /looked trough it again.
>
>Now since you came up with this cool trick (by Fabio) here comes
>'ironed' version :)
>
>
>
>.
>.
>   procedure form_de
>        lparameters oDataEnvironment
>        local i,arr_obj(1),oDEO
>        =amembers(arr_obj,oDataEnvironment,2)
>        for i = 1 to alen(arr_obj)
>            oDEO=getpem(oDataEnvironment, arr_obj(i))
>            if oDEO.BaseClass = 'Cursor'
>               oDEO.database = this.get_database(upper(justfname(oDEO.database)))
>            endif
>        endfor
>
>.
>.
>
>

This is better for me:
   procedure form_de
        lparameters oDataEnvironment
        local i,arr_obj(1)
        for i = 1 to amembers(arr_obj,oDataEnvironment,2)
            WITH getpem(oDataEnvironment, arr_obj(m.i))
             if .BaseClass == 'Cursor'
                .database = this.get_database(upper(justfname(.database)))
             endif
           ENDWITH
        endfor
>Thks++++++ :))
>
>
>
>
>>
>        for i = 1 to alen(arr_obj)
>>                 oCursor=getpem(oDataEnvironment, arr_obj(i))
>>>            j = oCursor.baseclass
>>>            if upper(alltrim(j)) = 'CURSOR'
>>>                db_name=upper(justfname(oCursor.database )))
>>>                oCursor.database=this.get_database(allt(db_name))
>>>                if !file(oCursor.database)
>>>                    messagebox('['oCursor.database+']'+chr(13)+;
>>>                        'Not found - Check Your blah..blah')
>>>                endif
>>>
>>
>>That's Fabio's "GetPem returns object" trick, and I love it. I've found that it made my code cleaner and leaner in many places.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform