Microsoft KB Archive/111315

{| = BROWSE Clauses Saved by PREFERENCE =
 * width="100%"|

ID: Q111315

The information in this article applies to:


 * Microsoft FoxPro for Windows, version 2.5b
 * Microsoft FoxPro for MS-DOS, version 2.5b
 * Microsoft FoxPro for Macintosh, version 2.5b

SUMMARY
The PREFERENCE clause of the BROWSE command is used to save certain attributes of a Browse window for later use. Some BROWSE clauses are saved by the PREFERENCE clause, others are not. This article explains which clauses are saved by the PREFERENCE clause and which are not.

MORE INFORMATION
The following BROWSE commands demonstrate clauses that are saved by the PREFERENCE clause:

BROWSE FIELDS client_id,company PREF b1  BROWSE FONT "Courier New",10 PREF b2   BROWSE STYLE "I" PREF b3

BROWSE FREEZE contact PREF b6  BROWSE PARTITION 20 LEDIT PREF b8   BROWSE PARTITION 20 REDIT PREF b9   BROWSE LOCK 2 PREF b10 BROWSE PARTITION 20 PREF b11 BROWSE PARTITION 20 LPARTITION PREF b12 BROWSE NOAPPEND PREF b13

BROWSE NODELETE PREF b15

BROWSE NOEDIT PREF b16 BROWSE NOMODIFY PREF b17

BROWSE PARTITION 20 NOLGRID PREF b18 BROWSE NORGRID PREF b19 BROWSE PARTITION 20 NOLINK PREF b20 BROWSE NOMENU PREF b21 BROWSE TITLE "Hello" PREF b29 BROWSE VALID myudf PREF b30 BROWSE WHEN mywhen PREF b33 BROWSE WIDTH 2 PREF b34 BROWSE WINDOW test PREF b35 BROWSE IN WINDOW test PREF b36 BROWSE COLOR SCHEME 3 PREF b37 BROWSE FIELD client_id,company:R PREF b38 BROWSE FIELD client_id,company:3 PREF b39 BROWSE FIELD client_id,company:v=myudf PREF b40 BROWSE FIELD client_id,company:v=myudf:F PREF b41 BROWSE FIELD client_id,company:v=myudf:F:E='Error' PREF b42 BROWSE FIELD client_id,company:P='!!!!!!!' PREF b43 BROWSE FIELD client_id,startbal:B=5,10 PREF b44 BROWSE FIELD client_id,startbal:B=5,10:F PREF b45 BROWSE FIELD client_id,startbal:H='Header' PREF b46 BROWSE FIELD client_id,startbal:W=mywhen PREF b47 The following BROWSE commands demonstrate clauses that are not saved by the PREFERENCE clause: BROWSE FOR client_id = "A8101" PREF b4  BROWSE KEY "A8101" PREF b7   BROWSE NOCLEAR PREF b14 BROWSE NOOPTIMIZE PREF b22 BROWSE NOREFRESH PREF b23 BROWSE NORMAL PREF b24 BROWSE NOWAIT PREF b25 BROWSE SAVE PREF b27 BROWSE TIMEOUT 3 PREF b28 BROWSE VALID :F myudf PREF b31 BROWSE VALID :F myudf ERROR "Error Here" PREF b32

Steps to Reproduce Behavior
The following code can be used to reproduce the behavior documented in this article.


 * brtest.prg *****************************************************************

* This program creates a Browse window, saves the preference,  * * action, and then compare the BROWSE PREFERENCE results. * PROCEDURE browpref
 * and then issues BROWSE PREFERENCE to verify       *
 * whether or not the preference was saved. The user must       *
 * pay close attention to the information that appears in       *
 * a WAIT WINDOW before each BROWSE variation, take any required *
 * * Run Instructions: * DO browpref IN brtest * Use Ctrl + W or Esc to exit each BROWSE window. * Press Esc repeatedly to terminate the program.

ON KEY LABEL F10 RETURN TO browpref ON KEY LABEL F2 DO varswap

mgood = .T.

SET RESO OFF IF !FILE("myres.dbf")

USE SYS(2005) AGAIN COPY STRUCTURE TO myres ENDIF CLOSE ALL SET RESOURCE TO myres CLEAR DEFINE WINDOW test FROM 05,05 TO 20,40 TITLE "mytestwin" COLO r/w,b/r

CLOSE ALL

SET SAFETY OFF

CREATE TABLE clients (CLIENT_ID C(5),COMPANY C(35), ;

CONTACT C(20),ADDRESS C(30),CITY C(15),STARTBAL N(5,2)) INSERT INTO clients (CLIENT_ID,COMPANY,CONTACT,ADDRESS,CITY, ; STARTBAL) VALUES ; ("A8331",; "Advantage Computer School           ",; "Martin Daniels      ", ; "575 Howell Ln.          ;   ","Wilmette     ",0)     INSERT INTO clients (CLIENT_ID,COMPANY,CONTACT,ADDRESS,CITY, ; STARTBAL) VALUES ; ("A8101",; "Automated Mayo Miley               ",; "Ardew Haldeman      ",; "229 Drank Suite 43            ",; "San Diego   ",0) INSERT INTO clients (CLIENT_ID,COMPANY,CONTACT,ADDRESS,CITY, ; STARTBAL) VALUES ; ("A8101",; "Automated Mayo Miley               ",; "Ardew Haldeman      ",; "229 Drank Suite 43            ",; "San Diego   ",0)     INSERT INTO clients (CLIENT_ID,COMPANY,CONTACT,ADDRESS,CITY, ; STARTBAL) VALUES ; ("A8101",; "Automated Mayo Miley               ",; "Ardew Haldeman      ",; "229 Drank Suite 43            ",; "San Diego   ",0) INSERT INTO clients (CLIENT_ID,COMPANY,CONTACT,ADDRESS,CITY, ; STARTBAL) VALUES ; ("B4876",; "Balance Computing Systems          ",; "M Rasmussen         ",; "7 Loop Readied                ",; "Sunnyvale   ",0) INSERT INTO clients (CLIENT_ID,COMPANY,CONTACT,ADDRESS,CITY, ; STARTBAL) VALUES ; ("B3615",; "Big Masters                        ",; "Dorit Springer      ",; "8920 Recsize Drive            ",; "Fairmont    ",0) INSERT INTO clients (CLIENT_ID,COMPANY,CONTACT,ADDRESS,CITY, ; STARTBAL) VALUES ; ("B5620",; "Blue Solutions                     ",; "Billy Barba         ",; "3972 Myron Drive 7            ",; "Canoga Park ",0) INDEX ON client_id TAG client_id SET SAFETY ON SET REFRESH TO 2

DO browchk

CLOSE ALL CLEAR ALL RELEASE ALL

RETURN

PROCEDURE browchk

BROWSE

WAIT WINDOW "BROWSE FIELDS client_id,company PREF b1" BROWSE FIELDS client_id,company PREF b1 BROWSE PREF b1

IF _windows

WAIT WINDOW "BROWSE FONT 'Courier New',10 PREF b2" BROWSE FONT "Courier New",10 PREF b2    BROWSE PREF b2 ELSE WAIT WINDOW "<> BROWSE FONT 'Courier New',10 PREF b2" ENDIF IF _windows

WAIT WINDOW "BROWSE STYLE 'I' PREF b3" BROWSE STYLE "I" PREF b3    BROWSE PREF b3 ELSE WAIT WINDOW "<> BROWSE STYLE 'I' PREF b3" ENDIF WAIT WINDOW "BROWSE FOR client_id = A8101 PREF b4" BROWSE FOR client_id = "A8101" PREF b4 BROWSE PREF b4

WAIT WINDOW "BROWSE FREEZE contact PREF b6" BROWSE FREEZE contact PREF b6 BROWSE PREF b6

WAIT WINDOW "BROWSE KEY 'A8101' PREF b7" BROWSE KEY "A8101" PREF b7 BROWSE PREF b7

WAIT WINDOW "BROWSE LEDIT PREF b8" BROWSE PARTITION 20 LEDIT PREF b8 BROWSE PREF b8

WAIT WINDOW "BROWSE REDIT PREF b9" BROWSE PARTITION 20 REDIT PREF b9 BROWSE PREF b9

WAIT WINDOW "BROWSE LOCK 2 PREF b10" BROWSE LOCK 2 PREF b10 BROWSE PREF b10

WAIT WINDOW "BROWSE PARTITION 2 PREF b11" BROWSE PARTITION 20 PREF b11 BROWSE PREF b11

WAIT WINDOW "BROWSE PARTITION 20 LPARTITION PREF b12" BROWSE PARTITION 20 LPARTITION PREF b12 BROWSE PREF b12

WAIT WINDOW "BROWSE NOAPPEND PREF b13" BROWSE NOAPPEND PREF b13 BROWSE PREF b13

WAIT WINDOW "BROWSE NOCLEAR PREF b14" BROWSE NOCLEAR PREF b14 WAIT WINDOW "image should be on screen, clear next" CLEAR BROWSE PREF b14 WAIT WINDOW "image should be on screen, clear next" CLEAR

WAIT WINDOW "BROWSE NODELETE PREF b15" BROWSE NODELETE PREF b15 BROWSE PREF b15

WAIT WINDOW "BROWSE NOEDIT PREF b16" BROWSE NOEDIT PREF b16 BROWSE PREF b16

WAIT WINDOW "BROWSE NOMODIFY PREF b17" BROWSE NOMODIFY PREF b17 BROWSE PREF b17

WAIT WINDOW "BROWSE PARTITION 20 NOLGRID PREF b18" BROWSE PARTITION 20 NOLGRID PREF b18 BROWSE PREF b18

WAIT WINDOW "BROWSE NORGRID PREF b19" BROWSE NORGRID PREF b19 BROWSE PREF b19

WAIT WINDOW "BROWSE NOLINK PREF b20" BROWSE PARTITION 20 NOLINK PREF b20 BROWSE PREF b20

WAIT WINDOW "BROWSE NOMENU PREF b21" BROWSE NOMENU PREF b21 BROWSE PREF b21

WAIT WINDOW "BROWSE NOOPTIMIZE PREF b22" BROWSE NOOPTIMIZE PREF b22 BROWSE PREF b22

WAIT WINDOW "BROWSE NOREFRESH PREF b23" BROWSE NOREFRESH PREF b23 BROWSE PREF b23

WAIT WINDOW "BROWSE NORMAL PREF b24" ACTI WIND test BROWSE NORMAL PREF b24 BROWSE PREF b24 DEAC WIND test

WAIT WINDOW "BROWSE NOWAIT PREF b25" BROWSE NOWAIT PREF b25 WAIT WINDOW "after br 1" BROWSE PREF b25 WAIT WINDOW "after br 2"

WAIT WINDOW "BROWSE SAVE PREF b27" BROWSE SAVE PREF b27 BROWSE PREF b27

WAIT WINDOW "BROWSE TIMEOUT 3 PREF b28" BROWSE TIMEOUT 3 PREF b28 WAIT WINDOW "after browse 1" BROWSE PREF b28 WAIT WINDOW "after browse 2"

WAIT WINDOW "BROWSE TITLE 'Hello' PREF b29" BROWSE TITLE "Hello" PREF b29 BROWSE PREF b29

WAIT WINDOW "BROWSE VALID myudf PREF b30" BROWSE VALID myudf PREF b30 BROWSE PREF b30

WAIT WINDOW "BROWSE VALID :F myudf PREF b31" BROWSE VALID :F myudf PREF b31 BROWSE PREF b31

WAIT WINDOW "BROWSE VALID :F myudf ERROR 'Error Here' PREF b32" BROWSE VALID :F myudf ERROR "Error Here" PREF b32 BROWSE PREF b32

WAIT WINDOW "BROWSE WHEN mywhen PREF b33" BROWSE WHEN mywhen PREF b33 BROWSE PREF b33

WAIT WINDOW "BROWSE WIDTH 20 PREF b34" BROWSE WIDTH 2 PREF b34 BROWSE PREF b34

WAIT WINDOW "BROWSE WINDOW test PREF b35" BROWSE WINDOW test PREF b35 BROWSE PREF b35

WAIT WINDOW "BROWSE IN WINDOW test PREF b36" ACTI WIND test BROWSE IN WINDOW test PREF b36 BROWSE PREF b36 DEAC WIND test

WAIT WINDOW "BROWSE COLOR SCHEME 3 PREF b37" BROWSE COLOR SCHEME 3 PREF b37 BROWSE PREF b37

WAIT WINDOW "BROWSE FIELD client_id,company:R PREF b38" BROWSE FIELD client_id,company:R PREF b38 BROWSE PREF b38

WAIT WINDOW "BROWSE FIELD client_id,company:3 PREF b39" BROWSE FIELD client_id,company:3 PREF b39 BROWSE PREF b39

WAIT WINDOW "BROWSE FIELD client_id,company:v=myudf PREF b40" BROWSE FIELD client_id,company:v=myudf PREF b40 BROWSE PREF b40

WAIT WINDOW "BROWSE FIELD client_id,company:v=myudf:F PREF b41" BROWSE FIELD client_id,company:v=myudf:F PREF b41 BROWSE PREF b41

WAIT WINDOW "BROWSE FIELD client_id,company:v=myudf:F:E='Error Text';

PREF b42" BROWSE FIELD client_id,company:v=myudf:F:E='Error Text' PREF b42 BROWSE PREF b42 WAIT WINDOW "BROWSE FIELD client_id,company:P='!!!!!!!' PREF b43" BROWSE FIELD client_id,company:P='!!!!!!!' PREF b43 BROWSE PREF b43

WAIT WINDOW "BROWSE FIELD client_id,startbal:B=5,10 PREF b44" BROWSE FIELD client_id,startbal:B=5,10 PREF b44 BROWSE PREF b44

WAIT WINDOW "BROWSE FIELD client_id,startbal:B=5,10:F PREF b45" BROWSE FIELD client_id,startbal:B=5,10:F PREF b45 BROWSE PREF b45

WAIT WINDOW "BROWSE FIELD client_id,startbal:H='Header Here' PREF b46" BROWSE FIELD client_id,startbal:H='Header Here' PREF b46 BROWSE PREF b46

WAIT WINDOW "BROWSE FIELD client_id,startbal:W=mywhen PREF b47" BROWSE FIELD client_id,startbal:W=mywhen PREF b47 BROWSE PREF b47

RETURN

FUNC myudf

WAIT WINDOW "We are validating" RETURN (mgood) FUNC mywhen

WAIT WINDOW "We are in the WHEN clasue" RETURN .T. PROC varswap

IF mgood = .T.         mgood = .F.     ELSE mgood = .T.    ENDIF RETURN
 * eof brtest.prg

Additional reference words: FoxMac FoxDos FoxWin 2.50b KBCategory: kbprg KBSubcategory: FxprgBrowse
 * }