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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Edit box search and scroll

Status
Not open for further replies.

rickbras

Programmer
Mar 16, 2000
12
US
I have a short search routine I use with an edit box to search my memo file. I have it set up to search each record for every occurence of the desired string. It goes from record to record by using CONTINUE then searches the record using the $ operator.&nbsp;&nbsp;All works fine until I reach the bottom of the edit box. When there is a match below the width of the edit box the text does not scroll to show it. I have to use the scroll bars to see the text. My simple routine consists of a LOCATE FOR to find the record then the $ operator to match each occurence of the search string. I then use an AT to find the starting point for SelStart to highlight the selected text.&nbsp;&nbsp;How do I get the text to scroll when the selected text is out of sight below the edit box width? I am using VFP 3.0. <br><br>Any and all help is appreciated.<br>Rick&nbsp;&nbsp;
 
I had to maintain an 2.6 application some time back that did something similar.&nbsp;&nbsp;VFP should be able to do the same thing.&nbsp;&nbsp;&nbsp;Can not exactly remember how it when but it was something like this.&nbsp;&nbsp;Maybe someone else can fill in the blanks.<br><br>I prefilled a FoxPro default Ctrl+F search string with the item to be located.&nbsp;&nbsp;It was either in the FoxUser File of a _memvar like _ClipText. anyway for this example I'll use the _ClipText memvar.&nbsp;&nbsp;Substitute as required when the correct command is found.<br><br>lcSeek = &quot;MF030201.G3F&quot;<br>_ClipText = lcSeek<br>scan&nbsp;&nbsp;for lcSeek $ table.Memo<br>&nbsp;&nbsp;lnRecno = recno()<br>&nbsp;&nbsp;copy memo to file text.txt<br>&nbsp;&nbsp;keyboard(&quot;Ctrl+G&quot;)<br>&nbsp;&nbsp;modi file text.txt&nbsp;&nbsp;&& The search string would be Highlighted and the cursor on the first letter of the string.<br>&nbsp;&nbsp;select alias<br>&nbsp;&nbsp;goto lnRecno<br>&nbsp;&nbsp;append memo table.memo from text.txt overwrite<br>endscan&nbsp;&nbsp;<br><br>The reason for the text file was a safety concern of the MIS Director at the company. Anyway, it should work in a Modi Memo window but I do not think it will work in a Edit Box, I could be wrong. <p>David W. Grewe<br><a href=mailto:Dave@internationalbid.net>Dave@internationalbid.net</a><br><a href= > </a><br>
 
Does the .setfocus method 'fix' it?&nbsp;&nbsp;Just tabbing to an editbox jumps it down to the selected text for me.&nbsp;&nbsp;I am running v6 however.&nbsp;&nbsp;<br>John Durbin
 
Thanks a million David and John. <br><br>&nbsp;David, It sounds like that would do the trick.&nbsp;&nbsp;However, I must use an edit box in this instance.&nbsp;&nbsp;By the way, in my haste to get the question asked I used the wrong word.... it is not the 'width' of the area I have to scroll to but the 'HEIGHT' is where I encounter the problem. When the selected text is below the bottom of the edit box.<br><br>John, I use&nbsp;&nbsp;the SetFocus method to enter the edit box and it works great. However, it still will not move the text up into the viewing area.&nbsp;&nbsp;I tried using the tab key to enter the edit box, but got the same results.&nbsp;&nbsp;If you can think of anything I might be overlooking I would appreciate the help very much.<br><br>Thanks again to both of you,<br>Rick
 
Yes I figured you meant the height.&nbsp;&nbsp;I use v6 so all I can tell you is I guess that won't be a problem if you upgrade.&nbsp;&nbsp;I dont' have 3 to test on.<br>Other idea, refresh the edit box?<br>JOhn Durbin
 
John,<br>Thanks again for the reply. It looks like I am going to be forced to upgrade sooner than I anticipated. I have a few things in the works right now in 3.0, but I may be able to convert without much problem.&nbsp;&nbsp;I Refresh the edit box each time a new string is found, but it unfortunately doesn't help.&nbsp;&nbsp;It may just be a trait of the 3.0 edit box or more likely some silly thing I am overlooking. I may have to go to another method of search or display.<br><br>Thanks again,<br>Rick
 
What known problems is there with converting from 3?&nbsp;&nbsp;Like I said I never dabbled with it.&nbsp;&nbsp;I can't imagine you not being happy you upgraded from 3.&nbsp;&nbsp;From what I've heard about it I&quot;m glad I never touched it.<br>John Durbin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top