×
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!
  • Students Click Here

*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.

Students Click Here

Jobs

Remove folder history from "Look Up Referece" in "Code Reference"
3

Remove folder history from "Look Up Referece" in "Code Reference"

Remove folder history from "Look Up Referece" in "Code Reference"

(OP)
Hi Team!

In VFP 9, we have "Code Reference" under "Tools". When you click search, it displays the "Look Up Reference" dialog where we mention all search parameters. There if the Scope is Folder, you can mention a folder in 'Look In'. The combo box attached to 'Look In' shows all those folders that were mentioned in previous searches, i.e. it saves the history.

Is there a way to remove/delete all those previous folder list that were used in previous searches?
In which VFP system table, these info are saved?

Thanks in advance
Rajesh

RE: Remove folder history from "Look Up Referece" in "Code Reference"

I haven't used Code Reference in years, it's way too slow and doesn't have many of the features we need every day. Try GoFish instead. https://github.com/mattslay/GoFish

RE: Remove folder history from "Look Up Referece" in "Code Reference"

(OP)
Hi Tore,

My problem is not getting a better one than Code Reference, but to remove the folder history it has currently.

Also, reference searches I do are simple. However, I will have a look in GoFish.
Thanks.

RE: Remove folder history from "Look Up Referece" in "Code Reference"

Rajesh,

The data is stored in the Resource file, under "FOXREF" Id, empty Name. The array that stores the list is FOXREF_FOLDER_MRU. To remove the history, you'll have to RESTORE the data, clear the array, and SAVE back the FOXREF_* data (probably having to set the checksum, also).

RE: Remove folder history from "Look Up Referece" in "Code Reference"

Not sure what you mean with folder history. If you want to remove the search history you can set a checkbox option when searching: "Overwrite previous results". That does not only remove previous results of tht search (that's done anyway, if you repeat a search, after you replaced something) it clears the whole search history.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: Remove folder history from "Look Up Referece" in "Code Reference"

I can confirm what Altopes said. I've just doen a couple of sample searches in Code References, using different folders. I can see a record in FoxUser that has ID = FOXREF and an empty name. The Data memo contains the names of the folders that I searched.

However, this is binary data, so it might be difficult to edit or delete parts of it. You could try deleting the entire record, which will probably clear all the Code References history. But you had better back it up first.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Remove folder history from "Look Up Referece" in "Code Reference"

Quote (Mike)

However, this is binary data, so it might be difficult to edit or delete parts of it.

The process would be something like this (warning! completely untested):

CODE --> VFP

RESTORE FROM MEMO data ADDITIVE
STORE "" TO FOXREF_FOLDER_MRU
SAVE TO MEMO data ALL LIKE FOXREF_* 

Don't know about the effect it would have on resource entry availability considering Ckval is not updated, but Rajesh may be willing to try (on a backup, of course, as the cleaning code itself).

RE: Remove folder history from "Look Up Referece" in "Code Reference"

(OP)
Dear Atlopes and Mike,

Both of you got exactly what I wanted.
Thank you both. I did it and saw that the history is gone!

Atlopes had a clear and accurate technical explanation, Great!,
while, you Mike, in your usual way, made it very simple and to the point!
Liked it!

Thanks
Rajesh

RE: Remove folder history from "Look Up Referece" in "Code Reference"

Glad it worked, Rajesh (but all the credit really belongs to Atlopes).

Can we now ask why you want to do this?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Remove folder history from "Look Up Referece" in "Code Reference"

I think I now know what you mean. The list of folders dropping down from "Look in".

The RESTORE FROM MEMO DATA of the corresponding Foxuser.dbf record always only holds 10 elements in an array FOXREF_FOLDER_MRU. Not much to clear, the easy and safe way without risking to store back too much further variables obviously is just picking 10 folders to override the MRU list.

Yes, you can RESTORE FROM MEMO DATA, edit variables, eg in the debugger locals window or by assignment commands and then store your changes back with SAVE TO MEMO DATA, but that'll save whatever other variables you have defined.

This is code from foxref.pjx of xsource.zip:

CODE

* Save preferences to FoxPro Resource file
	FUNCTION SavePrefs()
		LOCAL nSelect
		LOCAL lSuccess
		LOCAL nMemoWidth
		LOCAL nCnt
		LOCAL cData
		LOCAL i
		LOCAL oOptionCollection
		LOCAL ARRAY aFileList[1]
		LOCAL ARRAY FOXREF_OPTIONS[1]
		LOCAL ARRAY FOXREF_LOOKFOR_MRU[10]
		LOCAL ARRAY FOXREF_FOLDER_MRU[10]
		LOCAL ARRAY FOXREF_FILETYPES_MRU[10]

		IF !(SET("RESOURCE") == "ON")
			RETURN .F.
		ENDIF

		=ACOPY(THIS.aLookForMRU, FOXREF_LOOKFOR_MRU)
		=ACOPY(THIS.aReplaceMRU, FOXREF_REPLACE_MRU)
		=ACOPY(THIS.aFolderMRU, FOXREF_FOLDER_MRU)
		=ACOPY(THIS.aFileTypesMRU, FOXREF_FILETYPES_MRU)

		oOptionCollection = CREATEOBJECT("Collection")
		* Add any properties you want to save to
		* the resource file to this collection
		WITH oOptionCollection
			.Add(THIS.Comments, "Comments")
			.Add(THIS.MatchCase, "MatchCase")
			.Add(THIS.WholeWordsOnly, "WholeWordsOnly")
			.Add(THIS.Wildcards, "Wildcards")
			.Add(THIS.ProjectHomeDir, "ProjectHomeDir")
			.Add(THIS.SubFolders, "SubFolders")
			.Add(THIS.OverwritePrior, "OverwritePrior")
			.Add(THIS.FileTypes, "FileTypes")
			.Add(THIS.IncludeDefTable, "IncludeDefTable")
			.Add(THIS.CodeOnly, "CodeOnly")
			.Add(THIS.FormProperties, "FormProperties")
			.Add(THIS.AutoProjectHomeDir, "AutoProjectHomeDir")
			.Add(THIS.ConfirmReplace, "ConfirmReplace")
			.Add(THIS.BackupOnReplace, "BackupOnReplace")
			.Add(THIS.DisplayReplaceLog, "DisplayReplaceLog")
			.Add(THIS.PreserveCase, "PreserveCase")
			.Add(THIS.BackupStyle, "BackupStyle")
			.Add(THIS.ShowRefsPerLine, "ShowRefsPerLine")
			.Add(THIS.ShowFileTypeHistory, "ShowFileTypeHistory")
			.Add(THIS.ShowDistinctMethodLine, "ShowDistinctMethodLine")
			.Add(THIS.SortMostRecentFirst, "SortMostRecentFirst")
			.Add(THIS.FontString, "FontString")
			.Add(THIS.FoxRefDirectory, "FoxRefDirectory")
		ENDWITH

		DIMENSION FOXREF_OPTIONS[MAX(oOptionCollection.Count, 1), 2]
		FOR i = 1 TO oOptionCollection.Count
			FOXREF_OPTIONS[m.i, 1] = oOptionCollection.GetKey(m.i)
			FOXREF_OPTIONS[m.i, 2] = oOptionCollection.Item(m.i)
		ENDFOR


		nSelect = SELECT()
		
		lSuccess = .F.

  		* make sure Resource file exists and is not read-only
  		TRY
	  		nCnt = ADIR(aFileList, SYS(2005))
	  	CATCH
	  		nCnt = 0
	  	ENDTRY
	  		
		IF nCnt > 0 AND ATCC('R', aFileList[1, 5]) == 0
			IF !USED("FoxResource")
				USE (SYS(2005)) IN 0 SHARED AGAIN ALIAS FoxResource
			ENDIF
			IF USED("FoxResource") AND !ISREADONLY("FoxResource")
				nMemoWidth = SET('MEMOWIDTH')
				SET MEMOWIDTH TO 255

				SELECT FoxResource
				LOCATE FOR UPPER(ALLTRIM(type)) == "PREFW" AND UPPER(ALLTRIM(id)) == RESOURCE_ID AND EMPTY(name)
				IF !FOUND()
					APPEND BLANK IN FoxResource
					REPLACE ; 
					  Type WITH "PREFW", ;
					  ID WITH RESOURCE_ID, ;
					  ReadOnly WITH .F. ;
					 IN FoxResource
				ENDIF

				IF !FoxResource.ReadOnly
					SAVE TO MEMO Data ALL LIKE FOXREF_*

					REPLACE ;
					  Updated WITH DATE(), ;
					  ckval WITH VAL(SYS(2007, FoxResource.Data)) ;
					 IN FoxResource

					lSuccess = .T.
				ENDIF
				SET MEMOWIDTH TO (nMemoWidth)
			
				USE IN FoxResource
			ENDIF
		ENDIF

		SELECT (nSelect)
		
		RETURN lSuccess
	ENDFUNC 

From that, you could at least take to store back changes with the line

CODE

SAVE TO MEMO Data ALL LIKE FOXREF_* 

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: Remove folder history from "Look Up Referece" in "Code Reference"

(OP)
Hi Mike,

Quote (Mike)

Can we now ask why you want to do this?

We keep many folders containing codes for production development and many other for trial runs sets. After many references in all these, it becomes a long list which sometimes we don't need anymore. In fact, this list was there since long. So, wanted to clear everything.

But, as Olaf said above, I am not sure if it was only 10 in the list. Now, as it has already gone, no way to verify it!

Thank you all,
Rajesh

RE: Remove folder history from "Look Up Referece" in "Code Reference"

No need to verify, this is 1:1 code of the Code References feature and it has arrays dimensioned to fixed length 10 elements, if you use less than 10 directories elementsare stored empty, if you have 10 and add an 11th the oldest is reused.

You find the source code project in xsource.zip. If not you find a download still officially from MS: https://docs.microsoft.com/en-us/previous-versions...) or at VFPX: https://github.com/VFPX/XSource

It's in use anyway and the code simply shows it only memorizes several things 10 MRU slots. Might look cluttered enough, but there is that limit, you'll never overflow that.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

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