Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can we use ' code references' programmaticly?

Status
Not open for further replies.

Nifrabar

Programmer
Mar 16, 2003
1,343
NL
Hi!

Using the code reference from the tools menu is a very good tool.
Now I am wondering if we can do some automatic job with this tool.
What I wish:
I am having database with views and tables.
Now I need to update views and therefore I also need to know in which forms, procedures etc. these are used (in fact I also make some changes to the use of certain fields in those views).
So I like to cycle through all tables/views and let ' code references' find where these are all used.

-Bart
 

Bart,

Yes, this is possible, but difficult (or, at least, I found it so).

If you unpack the XSource folder (in your main VFP folder), you'll see a sub-folder named Foxref. This contains the source code for Code References. If you study this, you'll see that there is a main object that does most of the work. You should be able to call this programmatically, passing parameters to tell it what to do.

Unfortunately, I can't tell you anything else. I spent several hours trying to understand how it works, and finally had to give up. Nor could I find any documentation to help.

If you do manage to figure it out, or if anyone else knows how to do it, I'd really like to know about it.

In the meantime, let me suggest an alternative. Write a program that cycles through your views; for each view, add its name to a string. Format the string will regular expressions operators (especially "|" to indicate OR). Then copy that string to the clipboard and manually paste it into the Code Refs window. It's not full automation, but it will help achieve your goal.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
OK. I've made a start in figuring this out.

The following code will open the code references search window, and set the search string to the specified value:

Code:
loAction = CREATEOBJECT("RefAction")
loAction.Word = "Your search term here"
DO (_FOXREF) WITH loAction

DEFINE CLASS RefAction as custom
 Mode =  2
 Word = ""
 Filename = ""
 Lineno = 0
 Proc = ""
 Hwnd = 0
ENDDEFINE

Bart: I know this doesn't do everything you want, but it's a start. I'll carry on digging.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top