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

How to not exit Browse

Status
Not open for further replies.

FoxEgg

Programmer
Mar 24, 2002
749
AU
Hi, hopefully a simple one...

I have a BROWSE WHILE FILE_NUM = "ABCDEF"

If there are 6 FILE_NUMs equal to "ABCDEF" and I page down to BROWSE each record when the BROWSE gets to the sixth and I page down again... it kicks out and returns to the main program. This is correct behaviour but I want it to stop on the sixth... and only kick me out with an ESCAPE (say)

Is there an easy way to do this ?

I checked BROWSE help and there seems to be no obvious simple BROWSE command


FoxEgg

 
Actually ... Sorry, it is an EDIT not BROWSE.. but I cannot find an EDIT switch that does what I want either.

FoxEgg
 
Sorry REDIT din't work.

I came up with a little routine which seems to do the job.

SEEK FNUM && seeks the File in the indexed table
set console off
set talk off
set exact off
set escape on

DO WHILE FILE_NUM = FNUM
EDIT FIELDS Title, Last_name WHILE FILE_NUM = FNUM
SKIP -1 && keeps pointer in range at end
IF FILE_NUM = FNUM
ELSE
SKIP+1 && means it is at the top
ENDIF

IF LASTKEY()=27 && escape routine
EXIT
ELSE
ENDIF

SET TALK ON
SET EXACT OFF
SET ESCAPE OFF
ENDDO

I am not gods gift to programming... but it works..

Thanks for the suggestion Cricket..

Foxegg
 
If suggested BROWSE REDIT to mimic your EDIT command.
My version of Foxpro FPD2.6 does everything you specified as your requirement in your original question. PageUp and PageDn will not exit a BROWSE unless you have programmed these keys to return CHR(27) with an ON KEY LABEL or similar.

Your code is strange. SKIP -1 can give beginning of file errors, as you are moving the pointer 1 record back towards top of file. The first IF ELSE ENDIF section of code never executes.

 
You are absolutely right...

My "code SKIP -1 can give beginning of file errors, as you are moving the pointer 1 record back towards top of file. "

I did not appreciate that BOF error at all. Thanks

But "The first IF ELSE ENDIF section of code never executes."

I think it does,,, I need to test if the marker has gone over the top of the file ...

But REGARDLESS of what I think... your solution is more elegant... but I just couldn't make it work SO I will spend more time getting it going... Give me more time.

I'll be back

Thanks for the feedback

John
 
Try BROWSE FOR FILE_NUM = "ABCDEF"

:WHILE" lets you Browse, Edit or Change "WHILE" FILE_NUM = your key. If the key changes, then the browse function is completed - hence the browse window closes. The "FOR" condition will browse ONLY those records meeting your criteria and keep the window open until you close it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top