home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1996 May / PCDMAY.ISO / software / clarion / 3rdparty / tools / toolcrft / demo / demo004.clw < prev    next >
Encoding:
Text File  |  1995-10-23  |  117.7 KB  |  1,718 lines

  1.                      MEMBER('DEMO.clw')                         ! This is a MEMBER module
  2.                      MAP
  3.                        BrowseAdvanced:Update:BRWQ2(LONG,LONG,<LONG>,<BYTE>,<BYTE>)
  4.                      END
  5.                      MAP
  6.                        BrowseAdvanced:Update:BRWQ3(LONG,LONG,<BYTE>,<BYTE>)
  7.                      END
  8.                      MAP
  9.                        BrowseAdvanced:Update:BRWQ4(LONG,LONG,<BYTE>,<BYTE>)
  10.                      END
  11. MOD:DessertRcpDsp   STRING(5)
  12. MOD:SideRcpDsp   STRING(5)
  13. MOD:MainRcpDsp   STRING(5)
  14.  
  15.  
  16.  
  17.  
  18. BrowseAdvanced       PROCEDURE
  19.  
  20. !--------------------------------------------------------------------------------------------------!
  21. ! Declarations                                                                                     !
  22. !--------------------------------------------------------------------------------------------------!
  23. LocalRequest         LONG,AUTO
  24. LocalResponse        LONG,AUTO
  25. WindowOpened         LONG
  26. Search               STRING(40)
  27. MarkStatus           STRING(15)
  28. Search2              STRING(20)
  29. Search4              STRING(10)
  30. MarkStatus4          STRING(1)
  31. OriginalRequest      LONG,AUTO
  32. WindowInitialized    LONG
  33. ForceRefresh         LONG,AUTO
  34. LOC:SelectedRcpName  STRING(20)
  35. InLineActive         BYTE(1)
  36. WinWidth             LONG(334)                                  ! Save Window Width for Resizing
  37. WinHeight            LONG(174)                                  ! Save Window Height for Resizing
  38. CurrentSelected      LONG,AUTO                                  ! Save Current Selected Field
  39.  
  40. CMBSAV18:RCP:Name                LIKE(RCP:Name)                 ! Combo Save Field Value for Restore
  41. FORMAT:BRWQ2:Default EQUATE('60L|_~Ingredient~@S15@32L|_~Measure~@S8@8L|_~Quantity~@s5@')
  42. FORMAT:BRWQ2:Order2  EQUATE('32L(1)|_~Measure~@S8@#2#24L(1)|_~Qty~@S5@60L(1)|_~Ingredient~@S15@#1#')
  43.  
  44. SQ7:SortOrder        BYTE                                       !Current Sort Order for the List Box
  45. CWTabOrderQ:BRWQ2    QUEUE,PRE(SQ7)                             !Queue Use to Store Sort Order Info
  46. OrderName              STRING(60)                               !  Description shown in drop box
  47. SearchPicture          STRING(30)                               !  Picture Clause for Search Field
  48. OrderFormat            STRING(500)                              !  Format String for the List Box
  49.                      END                                        !End Queue Declaration
  50.  
  51. FORMAT:BRWQ3:Default EQUATE('18L(1)|_~Step~@N2@80L(1)|_~Instruction~@S20@')
  52.  
  53. FORMAT:BRWQ4:Default EQUATE('10L(1)|_@s1@39L(1)|_~Date~@D1@28L(1)|_~Main~@s5@29L(1)|_~Side~@s5@20L(1)|_~Dessert~@s5@')
  54.  
  55. MarkAllFlag4         BYTE                                       !Flag Indicating All Records Marked
  56. MarkQueue4           QUEUE,PRE(MQ11)                            !Queue Used to Store Marked Records
  57. Date                   LIKE(MEN:Date),NAME('TC_MarkKey')        !  Unique Record Id for the File
  58.                      END                                        !End Queue Declaration
  59.  
  60.  
  61. BRWQ                 QUEUE                                      !Queue Used by List when Browsing Records
  62. RCP:Name               LIKE(RCP:Name)                           !  Queue Display Field
  63. Position               STRING(255)                              !  Queue POSITION Information
  64.                      END                                        !End Queue Declaration
  65.  
  66. BRWQ2                QUEUE                                      !Queue Used by List when Browsing Records
  67. ING:Ingredient         LIKE(ING:Ingredient)                     !  Queue Display Field
  68. ING:Measure            LIKE(ING:Measure)                        !  Queue Display Field
  69. ING:Quantity           LIKE(ING:Quantity)                       !  Queue Display Field
  70. Position               STRING(255)                              !  Queue POSITION Information
  71.                      END                                        !End Queue Declaration
  72.  
  73. BRWQ3                QUEUE                                      !Queue Used by List when Browsing Records
  74. INS:Step               LIKE(INS:Step)                           !  Queue Display Field
  75. INS:Instruction        LIKE(INS:Instruction)                    !  Queue Display Field
  76. Position               STRING(255)                              !  Queue POSITION Information
  77.                      END                                        !End Queue Declaration
  78.  
  79. BRWQ4                QUEUE                                      !Queue Used by List when Browsing Records
  80. MarkStatus4            LIKE(MarkStatus4)                        !  Queue Display Field
  81. MEN:Date               LIKE(MEN:Date)                           !  Queue Display Field
  82. MOD:MainRcpDsp         LIKE(MOD:MainRcpDsp)                     !  Queue Display Field
  83. MOD:SideRcpDsp         LIKE(MOD:SideRcpDsp)                     !  Queue Display Field
  84. MOD:DessertRcpDsp      LIKE(MOD:DessertRcpDsp)                  !  Queue Display Field
  85. Position               STRING(255)                              !  Queue POSITION Information
  86.                      END                                        !End Queue Declaration
  87. RevOrder:BRWQ4       BYTE(1)
  88.  
  89.  
  90. Screen               WINDOW('Advanced Browse Exercise'),AT(,,334,174),FONT('MS Sans Serif',8,,),CENTER,STATUS,SYSTEM,GRAY,MAX,RESIZE,MDI,IMM
  91.                        SHEET,AT(6,18,155,85),USE(?ChangeOrder)
  92.                          TAB('By Ingredient'),USE(?Tab1)
  93.                          END
  94.                          TAB('By Measure'),USE(?Tab2)
  95.                          END
  96.                        END
  97.                        LIST,AT(11,48,146,36),MSG('Browsing Records'),ALRT(CtrlEnter),ALRT(InsertKey),ALRT(DeleteKey),USE(?List2),IMM,NOBAR,VSCROLL,FORMAT(FORMAT:BRWQ2:Default),FROM(BRWQ2)
  98.                        COMBO(@s20),AT(60,3,102,10),USE(LOC:SelectedRcpName),IMM,VSCROLL,FORMAT('80L~Name~@S20@'),DROP(6),FROM(BRWQ)
  99.                        PROMPT('Search:'),AT(11,34,25,10),USE(?Search:Prompt:1)
  100.                        ENTRY(@S40),AT(39,34,80,10),MSG('Enter Search Criteria'),USE(Search2)
  101.                        LIST,AT(6,107,155,38),MSG('Browsing Records'),ALRT(CtrlEnter),ALRT(InsertKey),ALRT(DeleteKey),USE(?List3),IMM,NOBAR,VSCROLL,FORMAT(FORMAT:BRWQ3:Default),FROM(BRWQ3)
  102.                        BUTTON('Insert'),AT(22,87,40,10),USE(?Insert)
  103.                        BUTTON('Change'),AT(61,87,40,10),USE(?Change)
  104.                        BUTTON('Delete'),AT(101,87,40,10),USE(?Delete)
  105.                        BUTTON('Insert'),AT(183,150,40,10),USE(?Insert:2)
  106.                        BUTTON('Change'),AT(223,150,40,10),USE(?Change:2)
  107.                        BUTTON('Delete'),AT(263,150,40,10),USE(?Delete:2)
  108.                        BUTTON('InLine On/Off'),AT(183,161,120,10),USE(?InLineToggle)
  109.                        BUTTON('Insert'),AT(22,148,40,10),USE(?Insert:3)
  110.                        BUTTON('Change'),AT(62,148,40,10),USE(?Change:3)
  111.                        BUTTON('Delete'),AT(102,148,40,10),USE(?Delete:3)
  112.                        LIST,AT(175,19,154,127),MSG('Browsing Records'),ALRT(CtrlEnter),ALRT(InsertKey),ALRT(DeleteKey),ALRT(SpaceKey),ALRT(ShiftSpace),USE(?List4),IMM,NOBAR,HVSCROLL,VCR,FORMAT(FORMAT:BRWQ4:Default),FROM(BRWQ4)
  113.                        PROMPT('Search:'),AT(175,4,25,10),USE(?Search:Prompt:2)
  114.                        ENTRY(@D1),AT(203,4,71,10),MSG('Enter Search Criteria'),USE(Search4),OVR
  115.                        BUTTON,AT(305,150,19,19),TIP('Use space key to mark records and press this button to print them.'),USE(?PrintMenu),ICON(ICON:Print)
  116.                        PROMPT('Recipe Name:'),AT(8,4,50,10),USE(?Prompt3)
  117.                        BUTTON('Close'),AT(302,5,28,10),USE(?Close)
  118.                        BUTTON('&Mark'),AT(171,29,40,10),USE(?Mark:1),HIDE
  119.                        BUTTON('&Unmark'),AT(171,37,40,10),USE(?Unmark:1),HIDE
  120.                        BUTTON('Mark &All'),AT(171,46,40,10),USE(?MarkAll:1),HIDE
  121.                        BUTTON('&Clear All'),AT(171,53,40,10),USE(?UnmarkAll:1),HIDE
  122.                      END
  123.  
  124.  
  125. !--------------------------------------------------------------------------------------------------!
  126. ! Code Section                                                                                     !
  127. !--------------------------------------------------------------------------------------------------!
  128.   CODE
  129.  
  130.   LocalRequest = GlobalRequest
  131.   OriginalRequest = LocalRequest
  132.   LocalResponse = RequestCancelled
  133.   ForceRefresh = False
  134.   CLEAR(GlobalRequest)
  135.   CLEAR(GlobalResponse)
  136.  
  137.   IF INGREDIENT::Used = 0
  138.     CheckOpen(INGREDIENT,1)
  139.   END
  140.   INGREDIENT::Used += 1
  141.   IF INSTRUCTION::Used = 0
  142.     CheckOpen(INSTRUCTION,1)
  143.   END
  144.   INSTRUCTION::Used += 1
  145.   IF MENU::Used = 0
  146.     CheckOpen(MENU,1)
  147.   END
  148.   MENU::Used += 1
  149.   IF RECIPE::Used = 0
  150.     CheckOpen(RECIPE,1)
  151.   END
  152.   RECIPE::Used += 1
  153.   IF RecipeAlias::Used = 0
  154.     CheckOpen(RecipeAlias,1)
  155.   END
  156.   RecipeAlias::Used += 1
  157.   CLEAR(RCP:Record)
  158.   SET(RCP:Key_Name)
  159.   NEXT(RECIPE)
  160.   LOC:SelectedRcpName = RCP:Name
  161.  
  162.   OPEN(Screen)
  163.   WindowOpened = True
  164.   INIRestoreWindow('BrowseAdvanced','PTDEMO.INI')
  165.   DO ResizeWindow                                               !Call Resize Window Routine
  166.   Screen{PROP:Imm} = 1                                          !Allow Resize Events to be Posted
  167.   HIDE(?List2)                                                  !Delay Display of List Box
  168.   HIDE(?List3)                                                  !Delay Display of List Box
  169.   HIDE(?List4)                                                  !Delay Display of List Box
  170.   ?InLineToggle{PROP:Text} = 'Using In-Line Editing'
  171.   DO LoadSortOrders:BRWQ2
  172.   SELECT(?List2)
  173.  
  174.  
  175.   ACCEPT                                                        !Begin Processing Event Loop
  176.                                                                 !
  177.     IF SELECTED() THEN CurrentSelected = SELECTED().            !Save Current Field Selection
  178.     CASE EVENT()                                                !Process Events for the Window
  179.     OF EVENT:OpenWindow
  180.       IF NOT WindowInitialized
  181.         DO InitializeWindow
  182.         WindowInitialized = True
  183.       END
  184.       SELECT(FIRSTFIELD())
  185.       UNHIDE(?List2)                                            !Unhide Filled List Box
  186.       UNHIDE(?List3)                                            !Unhide Filled List Box
  187.       UNHIDE(?List4)                                            !Unhide Filled List Box
  188.     OF EVENT:GainFocus
  189.       IF NOT WindowInitialized
  190.         WindowInitialized = True
  191.         DO InitializeWindow
  192.       ELSE
  193.         ForceRefresh = True
  194.         DO RefreshWindow
  195.       END
  196.     ELSE
  197.       IF EVENT() = EVENT:Sized                                  !IF Window Was Resized
  198.         DO ResizeWindow                                         !  Call Resize Window Routine
  199.       END                                                       !End If
  200.     END                                                         !End Events for Window
  201.  
  202.     CASE FIELD()                                                !Process Events for Controls
  203.     OF ?ChangeOrder                              
  204.       CASE EVENT()                           
  205.       OF EVENT:NewSelection                 
  206.         GET(CWTabOrderQ:BRWQ2,CHOICE())                         !Get Order settings from Sort Orders Queue
  207.         IF NOT ERROR()                                          !IF Valid Choice was Selected
  208.           SQ7:SortOrder = CHOICE()                              !  Set sort order
  209.           ?Search2{PROP:Text} = SQ7:SearchPicture               !  Set Picture for Search Field
  210.           ?List2{PROP:Format} = SQ7:OrderFormat                 !  Set number of rows in list box
  211.           TC_PROP:BRW(?List2,TCPROP:Rows,?List2{PROP:Items})    !  Reset number of rows property
  212.           TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh)    !  Tell Browse to start redisplay with a search by key
  213.           TC_PROP:BRW(?List2,TCPROP:SetToPosition,2)            !  Set Redisplay at Key Position from Queue
  214.           DO BrowseList:BRWQ2                                   !  Call BrowseList and Execute Redisplay
  215.         END                                                     !End
  216.       END                                    
  217.     OF ?List2
  218.       CASE EVENT()                           
  219.       OF EVENT:AlertKey                 
  220.         DO StepSearch:BRWQ2
  221.       END
  222.       DO BrowseCombo:BRWQ                                       ! Fill Browse Area
  223.       IF EVENT() <> EVENT:AlertKey AND |                        !If Not an Alert Key or a
  224.          EVENT() <> EVENT:PreAlertKey AND |                     !   Pre-Alert Key Event and
  225.          EVENT() <> EVENT:Selected                              !   Control not reselected
  226.         Search2 = ''                                            !  Clear the Search Input Field
  227.         DISPLAY(?Search2)                                       !  Display Locator Field
  228.       END                                                       !End If
  229.       DO BrowseList:BRWQ2                                       !Fill Browse Area
  230.     OF ?LOC:SelectedRcpName
  231.       CASE EVENT()                           
  232.       OF EVENT:Accepted                 
  233.         IF NOT TARGET{PROP:AcceptAll} AND NOT TC_PROP:BRW(?LOC:SelectedRcpName,TCPROP:DroppedDown)
  234.           POST(TCEVENT:AcceptSelection,?LOC:SelectedRcpName)
  235.         END
  236.         DO AddComboRecord:BRWQ
  237.         CYCLE
  238.       OF EVENT:NewSelection                 
  239.         DO AutoFillSearch:BRWQ
  240.         CYCLE
  241.       OF EVENT:DroppingDown                 
  242.         CMBSAV18:RCP:Name = RCP:Name                            ! Save Copy of Current Combo Value
  243.         RCP:Name = LOC:SelectedRcpName
  244.         SET(RCP:Key_Name,RCP:Key_Name)
  245.         NEXT(RECIPE)
  246.         TC_PROP:BRW(?LOC:SelectedRcpName,TCPROP:Action,TCACTION:Refresh)
  247.         TC_PROP:BRW(?LOC:SelectedRcpName,TCPROP:SetToPosition,1)
  248.       ELSE                                   
  249.         IF EVENT() = TCEVENT:RejectSelection                    !If Combo Field Selection was Rejected
  250.           POST(TCEVENT:AcceptSelection,?LOC:SelectedRcpName)    !  Force Accept Before Window Refresh
  251.         END                                                     !End
  252.         IF EVENT() = TCEVENT:AcceptSelection                    !If Combo Field Selection was Made
  253.           DO RefreshWindow                                      !  Force Window Refresh
  254.         END                                                     !End
  255.       END
  256.       DO BrowseCombo:BRWQ                                       ! Fill Browse Area
  257.     OF ?Search2                              
  258.       CASE EVENT()                           
  259.       OF EVENT:Accepted                 
  260.         DO EntrySearch:BRWQ2
  261.       END                                    
  262.     OF ?List3
  263.       DO BrowseCombo:BRWQ                                       ! Fill Browse Area
  264.       DO BrowseList:BRWQ3                                       !Fill Browse Area
  265.     OF ?Insert                              
  266.       CASE EVENT()                           
  267.       OF EVENT:Accepted                 
  268.         POST(TCEVENT:InsertRecord,?List2)                       !Send Insert Message to List Box
  269.       END                                    
  270.     OF ?Change                              
  271.       CASE EVENT()                           
  272.       OF EVENT:Accepted                 
  273.         POST(TCEVENT:ChangeRecord,?List2)                       !Send Change Message to List Box
  274.       END                                    
  275.     OF ?Delete                              
  276.       CASE EVENT()                           
  277.       OF EVENT:Accepted                 
  278.         POST(TCEVENT:DeleteRecord,?List2)                       !Send Delete Message to List Box
  279.       END                                    
  280.     OF ?Insert:2                              
  281.       CASE EVENT()                           
  282.       OF EVENT:Accepted                 
  283.         POST(TCEVENT:InsertRecord,?List4)                       !Send Insert Message to List Box
  284.       END                                    
  285.     OF ?Change:2                              
  286.       CASE EVENT()                           
  287.       OF EVENT:Accepted                 
  288.         POST(TCEVENT:ChangeRecord,?List4)                       !Send Change Message to List Box
  289.       END                                    
  290.     OF ?Delete:2                              
  291.       CASE EVENT()                           
  292.       OF EVENT:Accepted                 
  293.         POST(TCEVENT:DeleteRecord,?List4)                       !Send Delete Message to List Box
  294.       END                                    
  295.     OF ?InLineToggle                              
  296.       CASE EVENT()                           
  297.       OF EVENT:Accepted                 
  298.         IF InLineActive
  299.           ?InLineToggle{PROP:Text} = 'Using Form Editing'
  300.           InLineActive = 0
  301.         ELSE
  302.           ?InLineToggle{PROP:Text} = 'Using In-Line Editing'
  303.           InLineActive = 1
  304.         END
  305.         SELECT(TC:BRW:ActiveList)
  306.       END                                    
  307.     OF ?Insert:3                              
  308.       CASE EVENT()                           
  309.       OF EVENT:Accepted                 
  310.         POST(TCEVENT:InsertRecord,?List3)                       !Send Insert Message to List Box
  311.       END                                    
  312.     OF ?Change:3                              
  313.       CASE EVENT()                           
  314.       OF EVENT:Accepted                 
  315.         POST(TCEVENT:ChangeRecord,?List3)                       !Send Change Message to List Box
  316.       END                                    
  317.     OF ?Delete:3                              
  318.       CASE EVENT()                           
  319.       OF EVENT:Accepted                 
  320.         POST(TCEVENT:DeleteRecord,?List3)                       !Send Delete Message to List Box
  321.       END                                    
  322.     OF ?List4
  323.       CASE EVENT()                           
  324.       OF EVENT:Locate                 
  325.         SELECT(?Search4)                                        !Select Locator Field
  326.       OF EVENT:AlertKey                 
  327.         CASE KEYCODE()                                          !Process Alert Keys for Marking
  328.         OF SpaceKey                                             !  On Mark/Unmark Key
  329.           GET(BRWQ4,CHOICE(?List4))                             !    Reget Current Record ID
  330.           MQ11:Date = BRWQ4:MEN:Date                            !    Prepare to Search for Marked Record
  331.           GET(MarkQueue4,MQ11:Date)                             !    See if Record is Marked
  332.           IF (ERROR() AND NOT MarkAllFlag4) OR |                !
  333.              (NOT ERROR() AND MarkAllFlag4)                     !    IF Record is Not Marked
  334.             POST(EVENT:Accepted,?Mark:1)                        !      Mark the Record
  335.           ELSE                                                  !    Otherwise
  336.             POST(EVENT:Accepted,?Unmark:1)                      !      Unmark the Record
  337.           END                                                   !    End If
  338.           CYCLE                                                 !    Cycle to Top of Event Loop
  339.         OF ShiftSpace                                           !  On MarkAll/UnMarkAll Key
  340.           IF NOT MarkAllFlag4                                   !    If Not All Records Marked Before
  341.             POST(EVENT:Accepted,?MarkAll:1)                     !      Mark All Records
  342.           ELSE                                                  !    Otherwise
  343.             POST(EVENT:Accepted,?UnmarkAll:1)                   !      Unmark All Records
  344.           END                                                   !    End If
  345.           CYCLE                                                 !    Cycle to Top of Event Loop
  346.         END                                                     !End Case
  347.       END
  348.       DO BrowseCombo:BRWQ                                       ! Fill Browse Area
  349.       IF EVENT() <> EVENT:AlertKey AND |                        !If Not an Alert Key or a
  350.          EVENT() <> EVENT:PreAlertKey AND |                     !   Pre-Alert Key Event and
  351.          EVENT() <> EVENT:Selected                              !   Control not reselected
  352.         Search4 = ''                                            !  Clear the Search Input Field
  353.         DISPLAY(?Search4)                                       !  Display Locator Field
  354.       END                                                       !End If
  355.       DO BrowseList:BRWQ4                                       !Fill Browse Area
  356.     OF ?Search4                              
  357.       CASE EVENT()                           
  358.       OF EVENT:Accepted                 
  359.         DO EntrySearch:BRWQ4
  360.       END                                    
  361.     OF ?PrintMenu                              
  362.       CASE EVENT()                           
  363.       OF EVENT:Accepted                 
  364.         IF RECORDS(MarkQueue4)
  365.           TC:BRW:ProcessMarked = True
  366.           TC:BRW:MarkQueue &= MarkQueue4
  367.           TC:BRW:MarkAllFlag = MarkAllFlag4
  368.         ELSE
  369.           TC:BRW:ProcessMarked = False
  370.         END
  371.         START(PrintMenu,25000)
  372.         LocalRequest = OriginalRequest
  373.         DO RefreshWindow
  374.       END                                    
  375.     OF ?Close                              
  376.       CASE EVENT()                           
  377.       OF EVENT:Accepted                 
  378.         LocalResponse = RequestCancelled
  379.         POST(Event:CloseWindow)
  380.       END                                    
  381.     OF ?Mark:1                              
  382.       CASE EVENT()                           
  383.       OF EVENT:Accepted                 
  384.         GET(BRWQ4,CHOICE(?List4))                               !Reget Current Record ID
  385.         MQ11:Date = BRWQ4:MEN:Date                              !Prepare to Search for Marked Record
  386.         GET(MarkQueue4,MQ11:Date)                               !See if Record is Marked
  387.         IF NOT MarkAllFlag4                                     !If Not Marking All Exceptions
  388.           IF ERROR()                                            !  If Record Not Marked
  389.             BRWQ4:MarkStatus4 = 'X'                             !    Show Record as Marked in the List Box
  390.             MQ11:Date = BRWQ4:MEN:Date                          !    Set up to Add Record to the Mark Queue
  391.             ADD(MarkQueue4,MQ11:Date)                           !    Add the Record to the Mark Queue
  392.             PUT(BRWQ4)                                          !    Update the Changes to the List Box
  393.           END                                                   !  End If
  394.         ELSE                                                    !Otherwise Mark Table is an Exception List
  395.           IF NOT ERROR()                                        !  If Record Not Marked
  396.             BRWQ4:MarkStatus4 = 'X'                             !    Show Record as Marked in the List Box
  397.             DELETE(MarkQueue4)                                  !    Delete the Record from the Mark Queue
  398.             PUT(BRWQ4)                                          !    Update the Changes to the List Box
  399.           END                                                   !  End If
  400.         END                                                     !End If
  401.         POST(EVENT:ScrollDown,?List4)                           !Go Back to List and Move Down 1 Record
  402.       END                                    
  403.     OF ?Unmark:1                              
  404.       CASE EVENT()                           
  405.       OF EVENT:Accepted                 
  406.         GET(BRWQ4,CHOICE(?List4))                               !Reget Current Record ID
  407.         MQ11:Date = BRWQ4:MEN:Date                              !Prepare to Search for Marked Record
  408.         GET(MarkQueue4,MQ11:Date)                               !See if Record is Marked
  409.         IF NOT MarkAllFlag4                                     !If Not Marking All Exceptions
  410.           IF NOT ERROR()                                        !  If Record is Marked
  411.             BRWQ4:MarkStatus4 = ''                              !    Show Record as Not Marked in the List Box
  412.             DELETE(MarkQueue4)                                  !    Delete the Record from the Mark Queue
  413.             PUT(BRWQ4)                                          !    Update the Changes to the List Box
  414.           END                                                   !  End If
  415.         ELSE                                                    !Otherwise Mark Table is an Exception List
  416.           IF ERROR()                                            !  If Record is Marked
  417.             BRWQ4:MarkStatus4 = ''                              !    Show Record as Not Marked in the List Box
  418.             MQ11:Date = BRWQ4:MEN:Date                          !    Set up to Add Record to the Mark Queue
  419.             ADD(MarkQueue4,MQ11:Date)                           !    Add the Record to the Mark Queue
  420.             PUT(BRWQ4)                                          !    Update the Changes to the List Box
  421.           END                                                   !  End If
  422.         END                                                     !End If
  423.         POST(EVENT:ScrollDown,?List4)                           !Go Back to List and Move Down 1 Record
  424.       END                                    
  425.     OF ?MarkAll:1                              
  426.       CASE EVENT()                           
  427.       OF EVENT:Accepted                 
  428.         MarkAllFlag4 = 1                                        !Mark Queue is Now an Exception List
  429.         FREE(MarkQueue4)                                        !Mark All Records
  430.         LOOP Rec# = 1 TO RECORDS(BRWQ4)                         !Loop Through the List Boxes Records
  431.           GET(BRWQ4,Rec#)                                       !  Read the Queue Record
  432.           BRWQ4:MarkStatus4 = 'X'                               !  Show Record as Marked in the List Box
  433.           PUT(BRWQ4)                                            !  Update the Changes to the List Box
  434.         END                                                     !End Loop
  435.         SELECT(?List4)                                          !Go Back to List Box After Button Press
  436.       END                                    
  437.     OF ?UnmarkAll:1                              
  438.       CASE EVENT()                           
  439.       OF EVENT:Accepted                 
  440.         MarkAllFlag4 = 0                                        !Mark Queue is Now a List of Marked Records
  441.         FREE(MarkQueue4)                                        !UnMark All Records
  442.         LOOP Rec# = 1 TO RECORDS(BRWQ4)                         !Loop Through the List Boxes Records
  443.           GET(BRWQ4,Rec#)                                       !  Read the Queue Record
  444.           BRWQ4:MarkStatus4 = ''                                !  Show Record as Not Marked in the List Box
  445.           PUT(BRWQ4)                                            !  Update the Changes to the List Box
  446.         END                                                     !End Loop
  447.         SELECT(?List4)                                          !Go Back to List Box After Button Press
  448.       END                                    
  449.     END                                                         !End Events for Controls
  450.   END                                                           !End Event Loop
  451.                                                                 !
  452.   DO ProcedureReturn                                            !Cleanup and Exit the Procedure
  453.  
  454.  
  455. !--------------------------------------------------------------------------------------------------!
  456. ! InitializeWindow Routine                                                                         !
  457. !                                                                                                  !
  458. ! Initialize and Display window for the first time.                                                !
  459. !--------------------------------------------------------------------------------------------------!
  460. InitializeWindow   ROUTINE
  461.   DO RefreshWindow
  462.  
  463.  
  464. !--------------------------------------------------------------------------------------------------!
  465. ! RefreshWindow Routine                                                                            !
  466. !                                                                                                  !
  467. ! Redisplays the fields for the window.                                                            !
  468. !--------------------------------------------------------------------------------------------------!
  469. RefreshWindow      ROUTINE
  470.  
  471.   IF Screen{Prop:AcceptAll} THEN EXIT.
  472.   DO BrowseCombo:BRWQ
  473.   TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh)
  474.   TC_PROP:BRW(?List2,TCPROP:SetToItem,CHOICE(?List2))
  475.   TC_PROP:BRW(?List2,TCPROP:DontSelect,True)
  476.   DO BrowseList:BRWQ2
  477.   TC_PROP:BRW(?List3,TCPROP:Action,TCACTION:Refresh)
  478.   TC_PROP:BRW(?List3,TCPROP:SetToItem,CHOICE(?List3))
  479.   TC_PROP:BRW(?List3,TCPROP:DontSelect,True)
  480.   DO BrowseList:BRWQ3
  481.   TC_PROP:BRW(?List4,TCPROP:Action,TCACTION:Refresh)
  482.   TC_PROP:BRW(?List4,TCPROP:SetToItem,CHOICE(?List4))
  483.   TC_PROP:BRW(?List4,TCPROP:DontSelect,True)
  484.   DO BrowseList:BRWQ4
  485.   DISPLAY()
  486.   ForceRefresh = False
  487.  
  488.  
  489.  
  490.  
  491.  
  492. !--------------------------------------------------------------------------------------------------!
  493. ! ResizeWindow Routine                                                                             !
  494. !                                                                                                  !
  495. ! Resize the Window and Redsiplay any list boxes that were resized.Resized List Boxes              !
  496. !--------------------------------------------------------------------------------------------------!
  497. ResizeWindow       ROUTINE
  498.  
  499.   IF WinWidth = Screen{PROP:Width} AND |                        !If Window Width was not Changed AND
  500.      WinHeight = Screen{PROP:Height}                            !   Window Height was not Changed
  501.     EXIT                                                        !  Resize Not Needed - Exit Routine
  502.   END                                                           !End If
  503.                                                                 !
  504.   TC_ResizeWin(?List4,WinWidth,WinHeight,?List3)                !Reset Window Size
  505.   WinWidth = Screen{PROP:Width}                                 !Save Current Window Width
  506.   WinHeight = Screen{PROP:Height}                               !Save Current Window Height
  507.                                                                       !
  508.   IF NOT WindowInitialized THEN EXIT.                           !Refresh not needed if window not Init.
  509.                                                                 !
  510.   TC_PROP:BRW(?List3,TCPROP:Rows,?List3{PROP:Items})            !Reset Number of Rows in List Box
  511.   TC_PROP:BRW(?List3,TCPROP:SetToPosition,3)                    !Set for Redisplay at Key Position
  512.   TC_PROP:BRW(?List3,TCPROP:Action,TCACTION:Refresh)            !Tell Browse to Redisplay
  513.   DO BrowseList:BRWQ3                                           !Fill Browse Area
  514.                                                                 !
  515.   TC_PROP:BRW(?List4,TCPROP:Rows,?List4{PROP:Items})            !Reset Number of Rows in List Box
  516.   TC_PROP:BRW(?List4,TCPROP:SetToPosition,3)                    !Set for Redisplay at Key Position
  517.   TC_PROP:BRW(?List4,TCPROP:Action,TCACTION:Refresh)            !Tell Browse to Redisplay
  518.   DO BrowseList:BRWQ4                                           !Fill Browse Area
  519.                                                                 !
  520.   IF CurrentSelected THEN SELECT(CurrentSelected).              !Reslect Current Field
  521.  
  522.  
  523.  
  524. !--------------------------------------------------------------------------------------------------!
  525. ! BrowseCombo:BRWQ Routine                                                                         !
  526. !                                                                                                  !
  527. ! This routine calls the browser to do a page-loaded combo display from a file.                    !
  528. !--------------------------------------------------------------------------------------------------!
  529. BrowseCombo:BRWQ     ROUTINE
  530.  
  531.   IF EVENT() = TCEVENT:RejectSelection OR |                     !If User Rejected Combo Selection OR
  532.      NOT TC_PROP:BRW(?LOC:SelectedRcpName,TCPROP:Initialized)   !  Browse Not Intialized
  533.     IF EVENT() = TCEVENT:RejectSelection                        !  If User Rejected Combo Selection
  534.       RCP:Name = CMBSAV18:RCP:Name                              !  Restore to Value Before Dropping Down
  535.     END                                                         !  End If
  536.     CLEAR(RCP:RECORD)                                           !  Clear Record Area
  537.     RCP:Name = LOC:SelectedRcpName                              !  Set Lookup Key Value
  538.     GET(RECIPE,RCP:Key_Name)                                    !  Get Current Record
  539.     LOC:SelectedRcpName = RCP:Name                              !  Set Combo Field Value
  540.     DISPLAY(?LOC:SelectedRcpName)                               !  Redisplay Combo Field
  541.   END                                                           !End If
  542.   
  543.   IF EVENT() = TCEVENT:AcceptSelection                          !If User Accepted combo Selection
  544.     LOC:SelectedRcpName = RCP:Name                              !  Set Related Combo Field
  545.     LOC:SelectedRcpName = RCP:Name                              !  Set Combo Field Value
  546.     DISPLAY(?LOC:SelectedRcpName)                               !  Redisplay Combo Field
  547.     ?LOC:SelectedRcpName{PROP:Touched}=FALSE                    !  Set Field as Changed
  548.   END                                                           !End If
  549.  
  550.   IF NOT TC_PROP:BRW(?LOC:SelectedRcpName,TCPROP:Initialized)   !If Browse Not Initialized
  551.     IF NOT TC_InitBrowse(?LOC:SelectedRcpName,THREAD()) THEN EXIT. !  Initialize Browse Processing for List Box
  552.   END                                                           !End If
  553.                                                                 !
  554.   IF NOT TC_PROP:BRW(?LOC:SelectedRcpName,TCPROP:DroppedDown)   !If Combo is Not Dropped Down
  555.     EXIT                                                        !  Don't Call Browse Procedure
  556.   END                                                           !End
  557.                                                                 !
  558.   LOOP                                                          !Process File Browse Loop
  559.     TC_Browse(?LOC:SelectedRcpName ,|                           !  Browse Handle
  560.               RECIPE               ,|                           !  File Name
  561.               RCP:RECORD           ,|                           !  Record Area
  562.               RCP:Key_Name         ,|                           !  Key Order for Display
  563.               BRWQ                 ,|                           !  Queue Name for List
  564.               BRWQ:Position        )                            !  Record Position in Key Order
  565.  
  566.     CASE TC_PROP:BRW(?LOC:SelectedRcpName,TCPROP:Action)        !Process Browse Actions
  567.     OF TCACTION:FillQueue                                       !Fill List Queue Action
  568.       BRWQ:RCP:Name = RCP:Name                                  !  Move Data to Queue
  569.                                                                 !
  570.     OF TCACTION:ExitBrowse                                      !Exit Browse Action
  571.       BREAK                                                     !
  572.     END                                                         !End Process Browse Actions
  573.   END                                                           !End Process File Browse Loop
  574.  
  575.  
  576.  
  577. !--------------------------------------------------------------------------------------------------!
  578. ! AutoFillSearch:BRWQ Routine                                                                      !
  579. !                                                                                                  !
  580. ! This routine processes a auto fill search for ?LOC:SelectedRcpName                               !
  581. !--------------------------------------------------------------------------------------------------!
  582. AutoFillSearch:BRWQ  ROUTINE
  583.  
  584.   IF TC_PROP:BRW(?LOC:SelectedRcpName,TCPROP:DroppedDown) THEN EXIT. !Don't Search if Combo is Dropped Down
  585.  
  586.   TC_AutoFill(RECIPE               ,|                           !File Name
  587.               RCP:RECORD           ,|                           !Record Area
  588.               RCP:Key_Name         ,|                           !Key Order for Display
  589.               RCP:Name             ,|                           !Field to Lookup
  590.               LOC:SelectedRcpName  ,|                           !Entry Field to Fill
  591.               False                )                            !Disable Record Filtering
  592.   ?LOC:SelectedRcpName{PROP:Touched} = True                     !Set Entry Field as Changed
  593.   LOC:SelectedRcpName = RCP:Name                                !  Set Related Combo Field
  594.  
  595.  
  596. !--------------------------------------------------------------------------------------------------!
  597. ! AddComboRecord:BRWQ Routine                                                                      !
  598. !                                                                                                  !
  599. ! This routine adds a new record for a drop combo.                                                 !
  600. !--------------------------------------------------------------------------------------------------!
  601. AddComboRecord:BRWQ  ROUTINE
  602.  
  603.   IF NOT LOC:SelectedRcpName THEN EXIT.
  604.   RCP:Name = LOC:SelectedRcpName
  605.   GET(RECIPE,RCP:Key_Name)
  606.   IF NOT ERRORCODE() THEN EXIT.
  607.  
  608.   BEEP(1)
  609.  
  610.   Button# = MESSAGE('Would you like to add a new record?', |
  611.                     'Record Not On File',|
  612.                     ICON:Question,BUTTON:Yes+BUTTON:No)
  613.  
  614.   IF Button# = BUTTON:Yes
  615.     GET(RECIPE,0)
  616.     CLEAR(RCP:RECORD)
  617.     RCP:Name = LOC:SelectedRcpName
  618.     GlobalRequest = InsertRecord
  619.     UpdateRecipe
  620.     IF GlobalResponse = RequestCompleted
  621.       LOC:SelectedRcpName = RCP:Name                            !  Set Related Combo Field
  622.       DISPLAY(?LOC:SelectedRcpName)
  623.       POST(EVENT:Accepted,?LOC:SelectedRcpName)
  624.       EXIT
  625.     END
  626.   END
  627.  
  628.   CLEAR(LOC:SelectedRcpName)
  629.   SELECT(?LOC:SelectedRcpName)
  630.   ?LOC:SelectedRcpName{PROP:Touched} = True
  631.  
  632.  
  633.  
  634. !--------------------------------------------------------------------------------------------------!
  635. ! BrowseList:BRWQ2 Routine                                                                         !
  636. !                                                                                                  !
  637. ! This routine calls the browser to do a page-loaded display from a file.                          !
  638. !--------------------------------------------------------------------------------------------------!
  639. BrowseList:BRWQ2     ROUTINE
  640.  
  641.   IF NOT TC_PROP:BRW(?List2,TCPROP:Initialized)                 !If Browse Not Initialized
  642.     IF NOT TC_InitBrowse(?List2,THREAD()) THEN EXIT.            !  Initialize Browse Processing for List Box
  643.     TC_PROP:BRW(?List2,TCPROP:InsertMode,1)                     !  Set Insert Mode to Top of List
  644.     IF LocalRequest = SelectRecord                              !  If Browse Procedure Called as a Lookup
  645.       TC_PROP:BRW(?List2,TCPROP:SetToPosition,1)                !    Start Lookup on Current Record
  646.       TC_PROP:BRW(?List2,TCPROP:SelectRecord,True)              !    Set Double Click to Select Record
  647.     END                                                         !  End If
  648.   END                                                           !End If
  649.                                                                 !
  650.   LOOP                                                          !Process File Browse Loop
  651.     CASE SQ7:SortOrder                                          !Browse for Current Sort Order
  652.     OF 1                                                        !Sort Order Is By Ingredient
  653.       TC_Browse(?List2               ,|                         !  Browse Handle
  654.                 INGREDIENT           ,|                         !  File Name
  655.                 ING:RECORD           ,|                         !  Record Area
  656.                 ING:Key_Ingredient   ,|                         !  Key Order for Display
  657.                 BRWQ2                ,|                         !  Queue Name for List
  658.                 BRWQ2:Position       ,|                         !  Record Position in Key Order
  659.                 ING:RecipeNo         ,|                         !  Range Field
  660.                 RCP:RecipeNo         ,|                         !  Match Range - Low Value
  661.                 RCP:RecipeNo         )                          !  Match Range - High Value
  662.     OF 2                                                        !Sort Order Is By Measure
  663.       TC_Browse(?List2               ,|                         !  Browse Handle
  664.                 INGREDIENT           ,|                         !  File Name
  665.                 ING:RECORD           ,|                         !  Record Area
  666.                 ING:Key_Measure      ,|                         !  Key Order for Display
  667.                 BRWQ2                ,|                         !  Queue Name for List
  668.                 BRWQ2:Position       ,|                         !  Record Position in Key Order
  669.                 ING:RecipeNo         ,|                         !  Range Field
  670.                 RCP:RecipeNo         ,|                         !  Match Range - Low Value
  671.                 RCP:RecipeNo         )                          !  Match Range - High Value
  672.     END                                                         !End Case On Sort Orders
  673.  
  674.     CASE TC_PROP:BRW(?List2,TCPROP:Action)                      !Process Browse Actions
  675.     OF TCACTION:FillQueue                                       !Fill List Queue Action
  676.       MQ11:Date = MEN:Date                                      !  Prepare to Search for Marked Record
  677.       GET(MarkQueue4,MQ11:Date)                                 !  See if Record is Marked
  678.       IF (NOT MarkAllFlag4 AND NOT ERROR()) OR |                !  If Record is Marked
  679.           (MarkAllFlag4 AND ERROR())                            !
  680.         MarkStatus4 = 'X'                                       !    Show Record as Marked
  681.       ELSE                                                      !  Otherwise
  682.         MarkStatus4 = ''                                        !    Show Record as Not Marked
  683.       END                                                       !  End If
  684.       BRWQ2:ING:Ingredient = ING:Ingredient                     !  Move Data to Queue
  685.       BRWQ2:ING:Measure = ING:Measure                           !  Move Data to Queue
  686.       BRWQ2:ING:Quantity = ING:Quantity                         !  Move Data to Queue
  687.                                                                 !
  688.     OF TCACTION:InsertRecord                                    !Insert Record Action
  689.       GET(INGREDIENT,0)                                         !  Clear Pending Record
  690.       CLEAR(ING:RECORD)                                         !  Clear Record Area
  691.       DISABLE(?ChangeOrder)                                     !  Disable Change Order Control
  692.       BrowseAdvanced:Update:BRWQ2(?List2,TCACTION:InsertRecord,SQ7:SortOrder) !  Call In-Line Update Procedure
  693.       ENABLE(?ChangeOrder)                                      !  Enable Change Order Control
  694.       IF GlobalResponse = RequestCompleted                      !  If Update Completed
  695.         TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh)      !    Tell Browse to Redisplay
  696.         TC_PROP:BRW(?List2,TCPROP:SetToPosition,2)              !    Record at the current positon
  697.       ELSE                                                      !  Otherwise
  698.         DELETE(BRWQ2)                                           !    Delete Cancelled Queue Record
  699.         POST(EVENT:ScrollTop,?List2)                            !    Redisplay First Page of Records
  700.       END                                                       !  End If
  701.                                                                 !
  702.     OF TCACTION:ChangeRecord                                    !Change Record Action
  703.       DISABLE(?ChangeOrder)                                     !  Disable Change Order Control
  704.       BrowseAdvanced:Update:BRWQ2(?List2,TCACTION:ChangeRecord,SQ7:SortOrder) !  Call In-Line Update Procedure
  705.       ENABLE(?ChangeOrder)                                      !  Enable Change Order Control
  706.       TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh)        !  Tell Browse to Redisplay
  707.       TC_PROP:BRW(?List2,TCPROP:SetToPosition,2)                !  Record at the current positon
  708.                                                                 !
  709.     OF TCACTION:DeleteRecord                                    !Delete Record Action
  710.       DISABLE(?ChangeOrder)                                     !  Disable Change Order Control
  711.       BrowseAdvanced:Update:BRWQ2(?List2,TCACTION:DeleteRecord,SQ7:SortOrder) !  Call In-Line Update Procedure
  712.       ENABLE(?ChangeOrder)                                      !  Enable Change Order Control
  713.       TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh)        !  Tell Browse to Redisplay
  714.       TC_PROP:BRW(?List2,TCPROP:SetToItem,True)                 !  Record at the current positon
  715.                                                                 !
  716.     OF TCACTION:SelectRecord                                    !Select Record Action
  717.       LocalResponse = RequestCompleted                          !  Lookup was completed
  718.       POST(Event:CloseWindow)                                   !  Return Selected Record to Caller
  719.                                                                 !
  720.     OF TCACTION:DisplayFields                                   !Display Fields Action
  721.       IF RECORDS(BRWQ2)                                         !  If Records Displayed
  722.         ENABLE(?Change)                                         !    Enable Change Button
  723.         ENABLE(?Delete)                                         !    Enable Delete Button
  724.       ELSE                                                      !  Else
  725.         DISABLE(?Change)                                        !    Disable Change Button
  726.         DISABLE(?Delete)                                        !    Disable Delete Button
  727.       END                                                       !  End If
  728.                                                                 !
  729.     OF TCACTION:ExitBrowse                                      !Exit Browse Action
  730.       BREAK                                                     !
  731.     END                                                         !End Process Browse Actions
  732.   END                                                           !End Process File Browse Loop
  733.  
  734.  
  735.  
  736. !--------------------------------------------------------------------------------------------------!
  737. ! EntrySearch:BRWQ2 Routine                                                                        !
  738. !                                                                                                  !
  739. ! This routine processes a Entry search for ?List2                                                 !
  740. !--------------------------------------------------------------------------------------------------!
  741. EntrySearch:BRWQ2    ROUTINE
  742.  
  743.   CASE SQ7:SortOrder                                            !Setup Search for Current Sort Order
  744.   OF 1                                                          !For Current Sort Order
  745.     ING:Ingredient = Search2                                    !  Fill Search Key
  746.   OF 2                                                          !For Current Sort Order
  747.     ING:Measure = Search2                                       !  Fill Search Key
  748.   ELSE                                                          !Otherwise if not using a entry locator
  749.     EXIT                                                        !  Exit Routine
  750.   END                                                           !End Case
  751.  
  752.   Search2 = ''                                                  !Clear Search Input Field
  753.   DISPLAY(?Search2)                                             !
  754.   TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh)            !Tell Browse to Redisplay
  755.   TC_PROP:BRW(?List2,TCPROP:SetToKey,True)                      !Redisplay after searching by key
  756.   SELECT(?List2)                                                !Reselect Main List Box
  757.  
  758.  
  759.  
  760. !--------------------------------------------------------------------------------------------------!
  761. ! StepSearch:BRWQ2 Routine                                                                         !
  762. !                                                                                                  !
  763. ! This routine processes a step search for ?List2                                                  !
  764. !--------------------------------------------------------------------------------------------------!
  765. StepSearch:BRWQ2     ROUTINE
  766.  
  767.   IF INRANGE(KEYCODE(),KeyPad0,KeyPad9)                         !If Key is a numeric keypad key
  768.     SETKEYCODE(KEYCODE()-48)                                    !  Convert to regular numeric key
  769.   END                                                           !End If
  770.   IF (INRANGE(KEYCODE(),Key0,ZKey) OR |                         !If Key is a lower case 0-Z Key
  771.       INRANGE(KEYCODE(),Shift0,ShiftZ))                         !   or it's a upper case 0-Z Key
  772.     CASE SQ7:SortOrder                                          !  Setup Locator for Current Sort Order
  773.     OF 1                                                        !  For Sort Orders Not Using Incremental Search
  774.       ING:Ingredient = CHR(KEYCODE())                           !    Move character into locator
  775.     OF 2                                                        !  For Sort Orders Not Using Incremental Search
  776.       ING:Measure = CHR(KEYCODE())                              !    Move character into locator
  777.     END                                                         !  End Case
  778.     TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh)          !  Tell Browse to Redisplay
  779.     TC_PROP:BRW(?List2,TCPROP:SetToKey,True)                    !  Redisplay after searching by key
  780.   END                                                           !End If
  781.  
  782.  
  783.  
  784. !--------------------------------------------------------------------------------------------------!
  785. ! LoadSortOrders:BRWQ2 Routine                                                                     !
  786. !                                                                                                  !
  787. ! This routine loads the available sort options into the CWTabOrderQ:BRWQ2                         !
  788. !--------------------------------------------------------------------------------------------------!
  789. LoadSortOrders:BRWQ2 ROUTINE
  790.  
  791.   FREE(CWTabOrderQ:BRWQ2)                                       !Make sure queue is empty
  792.  
  793.   SQ7:SearchPicture = '@S15'                                    !Set Picture for Search Field
  794.   SQ7:OrderName = 'By Ingredient'                               !Set Name of Sort Order
  795.   SQ7:OrderFormat = FORMAT:BRWQ2:Default                        !Set Format String for Sort Order
  796.   ADD(CWTabOrderQ:BRWQ2)                                        !Add the option
  797.  
  798.   SQ7:SearchPicture = '@S15'                                    !Set Picture for Search Field
  799.   SQ7:OrderName = 'By Measure'                                  !Set Name of Sort Order
  800.   SQ7:OrderFormat = FORMAT:BRWQ2:Order2                         !Set Format String for Sort Order
  801.   ADD(CWTabOrderQ:BRWQ2)                                        !Add the option
  802.  
  803.   SQ7:SortOrder = 1                                             !Default to Sort Order #1
  804.   GET(CWTabOrderQ:BRWQ2,SQ7:SortOrder)                          !Get Sort Order Entry from Queue
  805.   SELECT(?ChangeOrder,SQ7:SortOrder)                            !Set Initial Sort Order for Drop Box
  806.   ?Search2{PROP:Text} = SQ7:SearchPicture                       !Set Initial Picture for Search Field
  807.   ?List2{PROP:Format} = SQ7:OrderFormat                         !Set Initial Format for List Box
  808.  
  809.  
  810.  
  811. !--------------------------------------------------------------------------------------------------!
  812. ! BrowseList:BRWQ3 Routine                                                                         !
  813. !                                                                                                  !
  814. ! This routine calls the browser to do a page-loaded display from a file.                          !
  815. !--------------------------------------------------------------------------------------------------!
  816. BrowseList:BRWQ3     ROUTINE
  817.  
  818.   IF NOT TC_PROP:BRW(?List3,TCPROP:Initialized)                 !If Browse Not Initialized
  819.     IF NOT TC_InitBrowse(?List3,THREAD()) THEN EXIT.            !  Initialize Browse Processing for List Box
  820.     TC_PROP:BRW(?List3,TCPROP:InsertMode,1)                     !  Set Insert Mode to Top of List
  821.     IF LocalRequest = SelectRecord                              !  If Browse Procedure Called as a Lookup
  822.       TC_PROP:BRW(?List3,TCPROP:SetToPosition,1)                !    Start Lookup on Current Record
  823.       TC_PROP:BRW(?List3,TCPROP:SelectRecord,True)              !    Set Double Click to Select Record
  824.     END                                                         !  End If
  825.   END                                                           !End If
  826.                                                                 !
  827.   LOOP                                                          !Process File Browse Loop
  828.     TC_Browse(?List3               ,|                           !  Browse Handle
  829.               INSTRUCTION          ,|                           !  File Name
  830.               INS:RECORD           ,|                           !  Record Area
  831.               INS:Key_Step         ,|                           !  Key Order for Display
  832.               BRWQ3                ,|                           !  Queue Name for List
  833.               BRWQ3:Position       ,|                           !  Record Position in Key Order
  834.               INS:RecipeNo         ,|                           !  Range Field
  835.               RCP:RecipeNo         ,|                           !  Match Range - Low Value
  836.               RCP:RecipeNo         )                            !  Match Range - High Value
  837.  
  838.     CASE TC_PROP:BRW(?List3,TCPROP:Action)                      !Process Browse Actions
  839.     OF TCACTION:FillQueue                                       !Fill List Queue Action
  840.       MQ11:Date = MEN:Date                                      !  Prepare to Search for Marked Record
  841.       GET(MarkQueue4,MQ11:Date)                                 !  See if Record is Marked
  842.       IF (NOT MarkAllFlag4 AND NOT ERROR()) OR |                !  If Record is Marked
  843.           (MarkAllFlag4 AND ERROR())                            !
  844.         MarkStatus4 = 'X'                                       !    Show Record as Marked
  845.       ELSE                                                      !  Otherwise
  846.         MarkStatus4 = ''                                        !    Show Record as Not Marked
  847.       END                                                       !  End If
  848.       BRWQ3:INS:Instruction = INS:Instruction                   !  Move Data to Queue
  849.       BRWQ3:INS:Step = INS:Step                                 !  Move Data to Queue
  850.                                                                 !
  851.     OF TCACTION:InsertRecord                                    !Insert Record Action
  852.       GET(INSTRUCTION,0)                                        !  Clear Pending Record
  853.       CLEAR(INS:RECORD)                                         !  Clear Record Area
  854.       BrowseAdvanced:Update:BRWQ3(?List3,TCACTION:InsertRecord) !  Call In-Line Update Procedure
  855.       IF GlobalResponse = RequestCompleted                      !  If Update Completed
  856.         TC_PROP:BRW(?List3,TCPROP:Action,TCACTION:Refresh)      !    Tell Browse to Redisplay
  857.         TC_PROP:BRW(?List3,TCPROP:SetToPosition,2)              !    Record at the current positon
  858.       ELSE                                                      !  Otherwise
  859.         DELETE(BRWQ3)                                           !    Delete Cancelled Queue Record
  860.         POST(EVENT:ScrollTop,?List3)                            !    Redisplay First Page of Records
  861.       END                                                       !  End If
  862.                                                                 !
  863.     OF TCACTION:ChangeRecord                                    !Change Record Action
  864.       BrowseAdvanced:Update:BRWQ3(?List3,TCACTION:ChangeRecord) !  Call In-Line Update Procedure
  865.       TC_PROP:BRW(?List3,TCPROP:Action,TCACTION:Refresh)        !  Tell Browse to Redisplay
  866.       TC_PROP:BRW(?List3,TCPROP:SetToPosition,2)                !  Record at the current positon
  867.                                                                 !
  868.     OF TCACTION:DeleteRecord                                    !Delete Record Action
  869.       BrowseAdvanced:Update:BRWQ3(?List3,TCACTION:DeleteRecord) !  Call In-Line Update Procedure
  870.       TC_PROP:BRW(?List3,TCPROP:Action,TCACTION:Refresh)        !  Tell Browse to Redisplay
  871.       TC_PROP:BRW(?List3,TCPROP:SetToItem,True)                 !  Record at the current positon
  872.                                                                 !
  873.     OF TCACTION:SelectRecord                                    !Select Record Action
  874.       LocalResponse = RequestCompleted                          !  Lookup was completed
  875.       POST(Event:CloseWindow)                                   !  Return Selected Record to Caller
  876.                                                                 !
  877.     OF TCACTION:DisplayFields                                   !Display Fields Action
  878.       IF RECORDS(BRWQ3)                                         !  If Records Displayed
  879.         ENABLE(?Change:3)                                       !    Enable Change Button
  880.         ENABLE(?Delete:3)                                       !    Enable Delete Button
  881.       ELSE                                                      !  Else
  882.         DISABLE(?Change:3)                                      !    Disable Change Button
  883.         DISABLE(?Delete:3)                                      !    Disable Delete Button
  884.       END                                                       !  End If
  885.                                                                 !
  886.     OF TCACTION:ExitBrowse                                      !Exit Browse Action
  887.       BREAK                                                     !
  888.     END                                                         !End Process Browse Actions
  889.   END                                                           !End Process File Browse Loop
  890.  
  891.  
  892.  
  893. !--------------------------------------------------------------------------------------------------!
  894. ! BrowseList:BRWQ4 Routine                                                                         !
  895. !                                                                                                  !
  896. ! This routine calls the browser to do a page-loaded display from a file.                          !
  897. !--------------------------------------------------------------------------------------------------!
  898. BrowseList:BRWQ4     ROUTINE
  899.  
  900.   IF NOT TC_PROP:BRW(?List4,TCPROP:Initialized)                 !If Browse Not Initialized
  901.     IF NOT TC_InitBrowse(?List4,THREAD()) THEN EXIT.            !  Initialize Browse Processing for List Box
  902.     IF LocalRequest = SelectRecord                              !  If Browse Procedure Called as a Lookup
  903.       TC_PROP:BRW(?List4,TCPROP:SetToPosition,1)                !    Start Lookup on Current Record
  904.       TC_PROP:BRW(?List4,TCPROP:SelectRecord,True)              !    Set Double Click to Select Record
  905.     END                                                         !  End If
  906.   END                                                           !End If
  907.                                                                 !
  908.   IF InLineActive                                               !If InLine Mode is Active
  909.     TC_PROP:BRW(?List4,TCPROP:InsertMode,1)                     !  Set Insert Mode to Top of List
  910.   ELSE                                                          !Otherwise
  911.     TC_PROP:BRW(?List4,TCPROP:InsertMode,0)                     !  Using Form - Turn off Insert Mode
  912.   END                                                           !End If
  913.                                                                 !
  914.   LOOP                                                          !Process File Browse Loop
  915.     TC_PROP:BRW(?List4,TCPROP:RevOrder,RevOrder:BRWQ4)          !  Set Reverse Ordering Flag
  916.     TC_Browse(?List4               ,|                           !  Browse Handle
  917.               MENU                 ,|                           !  File Name
  918.               MEN:RECORD           ,|                           !  Record Area
  919.               MEN:Key_Date         ,|                           !  Key Order for Display
  920.               BRWQ4                ,|                           !  Queue Name for List
  921.               BRWQ4:Position       )                            !  Record Position in Key Order
  922.  
  923.     CASE TC_PROP:BRW(?List4,TCPROP:Action)                      !Process Browse Actions
  924.     OF TCACTION:FillQueue                                       !Fill List Queue Action
  925.       MQ11:Date = MEN:Date                                      !  Prepare to Search for Marked Record
  926.       GET(MarkQueue4,MQ11:Date)                                 !  See if Record is Marked
  927.       IF (NOT MarkAllFlag4 AND NOT ERROR()) OR |                !  If Record is Marked
  928.           (MarkAllFlag4 AND ERROR())                            !
  929.         MarkStatus4 = 'X'                                       !    Show Record as Marked
  930.       ELSE                                                      !  Otherwise
  931.         MarkStatus4 = ''                                        !    Show Record as Not Marked
  932.       END                                                       !  End If
  933.       CLEAR(RCPALIAS:RECORD)
  934.       RCPALIAS:RecipeNo = MEN:MainRcpNo
  935.       GET(RecipeAlias,RCPALIAS:Key_RecipeNo)
  936.       MOD:MainRcpDsp = RCPALIAS:Code
  937.       CLEAR(RCPALIAS:RECORD)
  938.       RCPALIAS:RecipeNo = MEN:SideRcpNo
  939.       GET(RecipeAlias,RCPALIAS:Key_RecipeNo)
  940.       MOD:SideRcpDsp = RCPALIAS:Code
  941.       CLEAR(RCPALIAS:RECORD)
  942.       RCPALIAS:RecipeNo = MEN:DessertRcpNo
  943.       GET(RecipeAlias,RCPALIAS:Key_RecipeNo)
  944.       MOD:DessertRcpDsp = RCPALIAS:Code
  945.       BRWQ4:MEN:Date = MEN:Date                                 !  Move Data to Queue
  946.       BRWQ4:MOD:DessertRcpDsp = MOD:DessertRcpDsp               !  Move Data to Queue
  947.       BRWQ4:MOD:MainRcpDsp = MOD:MainRcpDsp                     !  Move Data to Queue
  948.       BRWQ4:MOD:SideRcpDsp = MOD:SideRcpDsp                     !  Move Data to Queue
  949.       BRWQ4:MarkStatus4 = MarkStatus4                           !  Move Data to Queue
  950.                                                                 !
  951.     OF TCACTION:InsertRecord                                    !Insert Record Action
  952.       IF InLineActive
  953.         MOD:MainRcpDsp = ''
  954.         MOD:SideRcpDsp = ''
  955.         MOD:DessertRcpDsp = ''
  956.       END
  957.       GET(MENU,0)                                               !  Clear Pending Record
  958.       CLEAR(MEN:RECORD)                                         !  Clear Record Area
  959.       IF InLineActive
  960.         BrowseAdvanced:Update:BRWQ4(?List4,TCACTION:InsertRecord) !  Call In-Line Update Procedure
  961.         IF GlobalResponse = RequestCompleted                    !  If Update Completed
  962.           TC_PROP:BRW(?List4,TCPROP:Action,TCACTION:Refresh)    !    Tell Browse to Redisplay
  963.           TC_PROP:BRW(?List4,TCPROP:SetToPosition,2)            !    Record at the current positon
  964.         ELSE                                                    !  Otherwise
  965.           DELETE(BRWQ4)                                         !    Delete Cancelled Queue Record
  966.           POST(EVENT:ScrollTop,?List4)                          !    Redisplay First Page of Records
  967.         END                                                     !  End If
  968.       ELSE
  969.         GlobalRequest = InsertRecord                            !  Tell Form To Insert Record
  970.         UpdateMenu                                              !  Insert Record
  971.         IF GlobalResponse = RequestCompleted                    !  If Record Added
  972.           TC_PROP:BRW(?List4,TCPROP:Action,TCACTION:Refresh)    !    Tell Browse to Redisplay
  973.           TC_PROP:BRW(?List4,TCPROP:SetToPosition,1)            !    Record at Current Key Positon
  974.         END                                                     !  End If
  975.       END
  976.                                                                 !
  977.     OF TCACTION:ChangeRecord                                    !Change Record Action
  978.       IF InLineActive
  979.        MOD:MainRcpDsp = BRWQ4:MOD:MainRcpDsp
  980.        MOD:SideRcpDsp = BRWQ4:MOD:SideRcpDsp
  981.        MOD:DessertRcpDsp = BRWQ4:MOD:DessertRcpDsp
  982.       END
  983.       IF InLineActive
  984.         BrowseAdvanced:Update:BRWQ4(?List4,TCACTION:ChangeRecord) !  Call In-Line Update Procedure
  985.         TC_PROP:BRW(?List4,TCPROP:Action,TCACTION:Refresh)      !  Tell Browse to Redisplay
  986.         TC_PROP:BRW(?List4,TCPROP:SetToPosition,2)              !  Record at the current positon
  987.       ELSE
  988.         GlobalRequest = ChangeRecord                            !  Tell Form To Change Record
  989.         UpdateMenu                                              !  Change Record
  990.         IF GlobalResponse = RequestCompleted                    !  If Record Added
  991.           TC_PROP:BRW(?List4,TCPROP:Action,TCACTION:Refresh)    !    Tell Browse to Redisplay
  992.           TC_PROP:BRW(?List4,TCPROP:SetToPosition,1)            !    Record at the Current Key Positon
  993.         END                                                     !  End If
  994.       END
  995.                                                                 !
  996.     OF TCACTION:DeleteRecord                                    !Delete Record Action
  997.       IF InLineActive
  998.         BrowseAdvanced:Update:BRWQ4(?List4,TCACTION:DeleteRecord) !  Call In-Line Update Procedure
  999.         TC_PROP:BRW(?List4,TCPROP:Action,TCACTION:Refresh)      !  Tell Browse to Redisplay
  1000.         TC_PROP:BRW(?List4,TCPROP:SetToItem,True)               !  Record at the current positon
  1001.       ELSE
  1002.         GlobalRequest = DeleteRecord                            !  Tell Form To Delete Record
  1003.         UpdateMenu                                              !  Delete Record
  1004.         IF GlobalResponse = RequestCompleted                    !  If Record Deleted
  1005.           TC_PROP:BRW(?List4,TCPROP:Action,TCACTION:Refresh)    !    Tell Browse to Redisplay
  1006.           TC_PROP:BRW(?List4,TCPROP:SetToItem,True)             !    Record at the Current Item
  1007.         END                                                     !  End If
  1008.       END
  1009.                                                                 !
  1010.     OF TCACTION:SelectRecord                                    !Select Record Action
  1011.       LocalResponse = RequestCompleted                          !  Lookup was completed
  1012.       POST(Event:CloseWindow)                                   !  Return Selected Record to Caller
  1013.                                                                 !
  1014.     OF TCACTION:DisplayFields                                   !Display Fields Action
  1015.       IF RECORDS(BRWQ4)                                         !  If Records Displayed
  1016.         ENABLE(?Mark:1)                                         !    Enable the Mark Button
  1017.         ENABLE(?Unmark:1)                                       !    Enable the Unmark Button
  1018.         ENABLE(?MarkAll:1)                                      !    Enable the Mark All Button
  1019.         ENABLE(?UnmarkAll:1)                                    !    Enable the Unmark All Button
  1020.         ENABLE(?Change:2)                                       !    Enable Change Button
  1021.         ENABLE(?Delete:2)                                       !    Enable Delete Button
  1022.       ELSE                                                      !  Else
  1023.         DISABLE(?Mark:1)                                        !    Disable the Mark Button
  1024.         DISABLE(?Unmark:1)                                      !    Disable the Unmark Button
  1025.         DISABLE(?MarkAll:1)                                     !    Disable the Mark All Button
  1026.         DISABLE(?UnmarkAll:1)                                   !    Disable the Unmark All Button
  1027.         DISABLE(?Change:2)                                      !    Disable Change Button
  1028.         DISABLE(?Delete:2)                                      !    Disable Delete Button
  1029.       END                                                       !  End If
  1030.                                                                 !
  1031.     OF TCACTION:ExitBrowse                                      !Exit Browse Action
  1032.       BREAK                                                     !
  1033.     END                                                         !End Process Browse Actions
  1034.   END                                                           !End Process File Browse Loop
  1035.  
  1036.  
  1037.  
  1038. !--------------------------------------------------------------------------------------------------!
  1039. ! EntrySearch:BRWQ4 Routine                                                                        !
  1040. !                                                                                                  !
  1041. ! This routine processes a Entry search for ?List4                                                 !
  1042. !--------------------------------------------------------------------------------------------------!
  1043. EntrySearch:BRWQ4    ROUTINE
  1044.  
  1045.   IF TC_PROP:BRW(?List4,TCPROP:RevOrder)                        !If Using Reverse Key Order
  1046.     MEN:Date = CLIP(Search4) & '<255>'                          !  Fill Search Key and Adjust for Key Order
  1047.   ELSE                                                          !Otherwise
  1048.     MEN:Date = Search4                                          !  Fill Search key
  1049.   END                                                           !End If
  1050.   Search4 = ''                                                  !Clear Search Input Field
  1051.   DISPLAY(?Search4)                                             !
  1052.   TC_PROP:BRW(?List4,TCPROP:Action,TCACTION:Refresh)            !Tell Browse to Redisplay
  1053.   TC_PROP:BRW(?List4,TCPROP:SetToKey,True)                      !Redisplay after searching by key
  1054.   SELECT(?List4)                                                !Reselect Main List Box
  1055.  
  1056.  
  1057.  
  1058. !--------------------------------------------------------------------------------------------------!
  1059. ! ProcedureReturn Routine                                                                                   !
  1060. !                                                                                                  !
  1061. ! End of procedure cleanup and exit.                                                               !
  1062. !--------------------------------------------------------------------------------------------------!
  1063. ProcedureReturn    ROUTINE
  1064.  
  1065.   INGREDIENT::Used -= 1
  1066.   IF INGREDIENT::Used = 0 THEN CLOSE(INGREDIENT).
  1067.   INSTRUCTION::Used -= 1
  1068.   IF INSTRUCTION::Used = 0 THEN CLOSE(INSTRUCTION).
  1069.   MENU::Used -= 1
  1070.   IF MENU::Used = 0 THEN CLOSE(MENU).
  1071.   RECIPE::Used -= 1
  1072.   IF RECIPE::Used = 0 THEN CLOSE(RECIPE).
  1073.   RecipeAlias::Used -= 1
  1074.   IF RecipeAlias::Used = 0 THEN CLOSE(RecipeAlias).
  1075.  
  1076.   IF WindowOpened
  1077.     INISaveWindow('BrowseAdvanced','PTDEMO.INI')
  1078.     CLOSE(Screen)
  1079.   END
  1080.  
  1081.   FREE(BRWQ)                                                    !Release Memory use by Browse Queue
  1082.   FREE(CWTabOrderQ:BRWQ2)                                       !Release Memory use by SortOrder Queue
  1083.   FREE(BRWQ2)                                                   !Release Memory use by Browse Queue
  1084.   FREE(BRWQ3)                                                   !Release Memory use by Browse Queue
  1085.   FREE(BRWQ4)                                                   !Release Memory use by Browse Queue
  1086.   FREE(MarkQueue4)                                              !Release Memory use by Mark Records Queue
  1087.  
  1088.   GlobalResponse = LocalResponse
  1089.   RETURN
  1090.  
  1091.  
  1092. !==================================================================================================!
  1093. !                                                                                                  !
  1094. ! BrowseAdvanced:Update:BRWQ2 Procedure                                                            !
  1095. ! ------------------------------------                                                             !
  1096. ! FILE NAME   : INGREDIENT                                                                         !
  1097. ! LIST CONTROL: ?List2                                                                             !
  1098. ! FROM QUEUE  : BRWQ2                                                                              !
  1099. !                                                                                                  !
  1100. !==================================================================================================!
  1101. BrowseAdvanced:Update:BRWQ2 PROCEDURE(ListControl,UpdateAction,SortOrder,AbortButton,SaveButton)
  1102.  
  1103. FieldOrder1          EQUATE('1,2,3')                            !Field Order for Sort Order 1
  1104. FieldOrder2          EQUATE('2,3,1')                            !Field Order for Sort Order 2
  1105.  
  1106. ?ING:Ingredient      EQUATE(101)                                !Set Field Number for ING:Ingredient
  1107. ?ING:Measure         EQUATE(102)                                !Set Field Number for ING:Measure
  1108. ?ING:Quantity        EQUATE(103)                                !Set Field Number for ING:Quantity
  1109.  
  1110. InLineFieldSetup     GROUP
  1111.                        LONG(CREATE:Entry)                       !Control Type for ?ING:Ingredient
  1112.                        LONG(CREATE:DropList)                    !Control Type for ?ING:Measure
  1113.                        LONG(CREATE:Spin)                        !Control Type for ?ING:Quantity
  1114.                      END
  1115. InLineFields         LONG,DIM(3),OVER(InLineFieldSetup)
  1116.  
  1117. LocalResponse        LONG,AUTO
  1118. SAVE:ING:RECORD      STRING(SIZE(ING:RECORD))
  1119.  
  1120.  
  1121.  
  1122.  
  1123. !--------------------------------------------------------------------------------------------------!
  1124. ! Code Section                                                                                     !
  1125. !--------------------------------------------------------------------------------------------------!
  1126.   CODE
  1127.  
  1128.   LocalResponse = RequestCancelled                              !Default to Request Cancelled
  1129.   CASE UpdateAction                                             !Process Setup for Update Actions
  1130.   OF TCACTION:InsertRecord                                      !On Insert New Record
  1131.     ING:RecipeNo = RCP:RecipeNo
  1132.     SAVE:ING:RECORD = ING:RECORD                                !  Save the Current Record
  1133.     ING:Quantity = 1                                            !  Prime Field
  1134.                                                                 !
  1135.   OF TCACTION:ChangeRecord                                      !On Change Record
  1136.     SAVE:ING:RECORD = ING:RECORD                                !  Save the Current Record
  1137.                                                                 !
  1138.   OF TCACTION:DeleteRecord                                      !On Delete Record
  1139.     DO DeleteRecord                                             !  Delete the Record
  1140.     GlobalResponse = LocalResponse                              !  Set Global Response
  1141.     RETURN                                                      !  Exit Update Procedure
  1142.   END                                                           !End Case
  1143.                                                                 !
  1144.   ListControl{PROP:NoBar} = 1                                   !Turn Off Point Bar
  1145.                                                                 !
  1146.   LOOP                                                          !Process InLine Actions
  1147.     IF UpdateAction = TCACTION:ChangeRecord                     !If Editing an Existing Record
  1148.       TC:INL:UpdateMode = 1                                     !  Use Column Edit Option
  1149.     END                                                         !End If
  1150.     TC:INL:FirstField = ?ING:Ingredient                         !Set First Field Number
  1151.     EXECUTE SortOrder                                           !Edit by Sort Order
  1152.       TC_InLine(ListControl,InLineFields[],FieldOrder1)         !Call InLine Editing
  1153.       TC_InLine(ListControl,InLineFields[],FieldOrder2)         !Call InLine Editing
  1154.     END                                                         !End Execute
  1155.                                                                 !
  1156.     CASE TC:INL:Action                                          !Process InLine Actions
  1157.     OF TCACTION:SetFields                                       !Set Field Properties Action
  1158.       !--------- ?ING:Ingredient ---------
  1159.       ?ING:Ingredient{PROP:Use} = ING:Ingredient
  1160.       ?ING:Ingredient{PROP:Msg} = 'Enter an Ingredient'
  1161.  
  1162.       !--------- ?ING:Measure ---------
  1163.       ?ING:Measure{PROP:Use} = ING:Measure
  1164.       ?ING:Measure{PROP:Msg} = 'Select a Measure'
  1165.       ?ING:Measure{PROP:Drop} = 7  
  1166.       ?ING:Measure{PROP:From} = 'cup|gallon|lb|ounce|pint|Tbl|tsp'
  1167.       ?ING:Measure{PROP:Format} = '32L@S8@'
  1168.  
  1169.       !--------- ?ING:Quantity ---------
  1170.       ?ING:Quantity{PROP:Use} = ING:Quantity
  1171.       ?ING:Quantity{PROP:Msg} = 'Select a Quantity'
  1172.       ?ING:Quantity{PROP:RangeHigh} = 99
  1173.       ?ING:Quantity{PROP:RangeLow} = 1
  1174.       ?ING:Quantity{PROP:Step} = 1
  1175.  
  1176.     OF TCACTION:SetHotKeys                                      !Set Hot Keys Action
  1177.       TC:INL:AbortKey = EscKey                                  !  Set Cancel Key
  1178.       TC:INL:SaveKey = CtrlEnter                                !  Set Save Key
  1179.       TC:INL:EditNextKey1 = DownKey                             !  Set Next Rec Key for Column Edit
  1180.       TC:INL:EditPrevKey1 = UpKey                               !  Set Previous Rec Key for Column Edit
  1181.     
  1182.     OF TCACTION:FieldEdits                                      !Process Field Edits Action
  1183.       CASE TC:INL:Field
  1184.       OF ?ING:Measure
  1185.         IF NOT ING:Measure
  1186.           BEEP
  1187.           TC:INL:AbortUpdate = ?ING:Measure
  1188.         END
  1189.       END
  1190.     
  1191.     OF TCACTION:UpdateRecord                                    !Update Record Action
  1192.       IF SAVE:ING:RECORD = ING:RECORD                           !If the Record was Not Changed
  1193.         LocalResponse = RequestCompleted                        !  Set Local Response to Completed
  1194.         CYCLE                                                   !  Nothing to Save - Exit In-Line
  1195.       END                                                       !End If
  1196.       LOOP                                                      !Attempt to Update Until Done or Canceled
  1197.         Error# = DUPLICATE(INGREDIENT)                          !  Test For Duplicate Key
  1198.         IF Error#                                               !  If Duplicate Key Error
  1199.           Button# = MESSAGE('Updating this record creates a duplicate entry!', |
  1200.                             'Duplicate Key Error',ICON:Exclamation,Button:OK,Button:OK,0)
  1201.         ELSE                                                    !  Otherwise
  1202.           SETCURSOR(Cursor:Wait)                                !    Show Hour-Glass Cursor
  1203.           IF UpdateAction = TCACTION:InsertRecord               !  If Inserting a New Record
  1204.             ADD(INGREDIENT)                                     !    Add the Record
  1205.             Error# = ERRORCODE()                                !    Set Error Flag
  1206.           ELSE                                                  !  Otherwise on Updating a Record
  1207.             Error# = RIUpdate:INGREDIENT()                      !    Attempt Update
  1208.           END                                                   !  End If
  1209.         END                                                     !  End If
  1210.         IF Error#                                               !  If Error Updating
  1211.           SETCURSOR()                                           !    Reset to Normal Cursor
  1212.           Button# = StandardWarning(Warn:UpdateError)           !    Ask If User Wants to Try Saving Again
  1213.           DISPLAY                                               !    Refresh Screen
  1214.           CASE Button#                                          !    Process User Response
  1215.           OF Button:Yes                                         !    On YES Button
  1216.              CYCLE                                              !      Retry Update Operation
  1217.           OF Button:No                                          !    On NO Button
  1218.             BREAK                                               !      Exit without Updating Record
  1219.           OF Button:Cancel                                      !    On Cancel Button
  1220.             TC:INL:AbortUpdate = True                           !      Tell Inline to Cancel Update Request
  1221.             BREAK                                               !      Go back to editing record
  1222.           END                                                   !    End Case
  1223.         END                                                     !  End If
  1224.         SETCURSOR()                                             !  Reset to Normal Cursor
  1225.         LocalResponse = RequestCompleted                        !  Set Local Response to Completed
  1226.         BREAK                                                   !  Exit Update Loop
  1227.       END                                                       !End Loop
  1228.                                                                 !
  1229.     OF TCACTION:AbortUpdate                                     !Abort Update Action
  1230.       IF TC:INL:ResizeWindow THEN CYCLE.                        !Always abort changes on resize
  1231.       IF SAVE:ING:RECORD <> ING:RECORD                          !If the Record was Changed
  1232.         Button# = StandardWarning(Warn:SaveOnCancel)            !  Display Save on Cancel Message
  1233.         DISPLAY                                                 !  Refresh Screen
  1234.         CASE Button#                                            !  Process User Response
  1235.         OF Button:Yes                                           !  On YES Button
  1236.           TC:INL:AbortUpdate = False                            !    Cancel the Request to Abort
  1237.           TC:INL:SelectField = ListControl                      !    Select List to Exit & Save Changes
  1238.         OF Button:No                                            !  On NO Button
  1239.           TC:INL:AbortUpdate = True                             !    Go Ahead and Abandon the Changes
  1240.         OF BUTTON:Cancel                                        !  On Cancel Button
  1241.           TC:INL:AbortUpdate = False                            !    Cancel the Request and Continue
  1242.         END                                                     !  End Case
  1243.       END                                                       !End If
  1244.       IF UpdateAction = TCACTION:InsertRecord                   !If Adding a New Record
  1245.         IF TC:INL:AbortUpdate = True                            !  If Record Add was Aborted
  1246.           DELETE(INGREDIENT)                                    !    Delete the New Record from the File
  1247.         END                                                     !  End If
  1248.       END                                                       !End If
  1249.                                                                 !
  1250.     OF TCACTION:ExitInLine                                      !Exit InLine Action
  1251.       BREAK                                                     !
  1252.     END                                                         !End Case on Actions
  1253.   END                                                           !End Loop
  1254.                                                                 !
  1255.   GlobalResponse = LocalResponse                                !Set Global Response
  1256.   RETURN                                                        !Exit In-Line Update Procedure
  1257.  
  1258.  
  1259.  
  1260.  
  1261. !--------------------------------------------------------------------------------------------------!
  1262. ! Delete Record Routine                                                                            !
  1263. !                                                                                                  !
  1264. ! This routine Deletes the Record.                                                                 !
  1265. !--------------------------------------------------------------------------------------------------!
  1266. DeleteRecord         ROUTINE
  1267.  
  1268.   LocalResponse = RequestCancelled                              !Default to Request to Delete Cancelled
  1269.                                                                 !
  1270.   Confirm# = StandardWarning(Warn:StandardDelete)               !Get Confirmation from User
  1271.   DISPLAY                                                       !Refresh Screen
  1272.   IF Confirm# <> Button:OK THEN EXIT.                           !If User Did Not Confirm Delete then Exit
  1273.                                                                 !
  1274.   LOOP                                                          !Attempt to Delete Until Done or Canceled
  1275.     SETCURSOR(Cursor:Wait)                                      !  Show Hour-Glass Cursor
  1276.     IF RIDelete:INGREDIENT()                                    !  If Error Deleting
  1277.       SETCURSOR()                                               !    Reset to Normal Cursor
  1278.       CASE StandardWarning(Warn:DeleteError)                    !    Ask If User Wants to Try Deleting Again
  1279.       OF Button:Yes                                             !    On YES Button
  1280.         CYCLE                                                   !      Retry Delete Operation
  1281.       OF Button:No                                              !    On NO Button
  1282.       OROF Button:Cancel                                        !    Or On Cancel Button
  1283.         BREAK                                                   !      Exit without Deleting Record
  1284.       END                                                       !    End Case
  1285.     END                                                         !  End If
  1286.     SETCURSOR()                                                 !  Reset to Normal Cursor
  1287.     LocalResponse = RequestCompleted                            !  Set Request Completed
  1288.     BREAK                                                       !  Exit Delete Loop
  1289.   END                                                           !End Loop
  1290.  
  1291.  
  1292.  
  1293.  
  1294. !==================================================================================================!
  1295. !                                                                                                  !
  1296. ! BrowseAdvanced:Update:BRWQ3 Procedure                                                            !
  1297. ! ------------------------------------                                                             !
  1298. ! FILE NAME   : INSTRUCTION                                                                        !
  1299. ! LIST CONTROL: ?List3                                                                             !
  1300. ! FROM QUEUE  : BRWQ3                                                                              !
  1301. !                                                                                                  !
  1302. !==================================================================================================!
  1303. BrowseAdvanced:Update:BRWQ3 PROCEDURE(ListControl,UpdateAction,AbortButton,SaveButton)
  1304.  
  1305. FieldOrder           EQUATE('1,2')                              !Field Order for Sort Order 
  1306.  
  1307. ?INS:Step            EQUATE(104)                                !Set Field Number for INS:Step
  1308. ?INS:Instruction     EQUATE(105)                                !Set Field Number for INS:Instruction
  1309.  
  1310. InLineFieldSetup     GROUP
  1311.                        LONG(CREATE:Spin)                        !Control Type for ?INS:Step
  1312.                        LONG(CREATE:Entry)                       !Control Type for ?INS:Instruction
  1313.                      END
  1314. InLineFields         LONG,DIM(2),OVER(InLineFieldSetup)
  1315.  
  1316. LocalResponse        LONG,AUTO
  1317. SAVE:INS:RECORD      STRING(SIZE(INS:RECORD))
  1318.  
  1319.  
  1320.  
  1321.  
  1322. !--------------------------------------------------------------------------------------------------!
  1323. ! Code Section                                                                                     !
  1324. !--------------------------------------------------------------------------------------------------!
  1325.   CODE
  1326.  
  1327.   LocalResponse = RequestCancelled                              !Default to Request Cancelled
  1328.   CASE UpdateAction                                             !Process Setup for Update Actions
  1329.   OF TCACTION:InsertRecord                                      !On Insert New Record
  1330.     INS:RecipeNo = RCP:RecipeNo
  1331.     SAVE:INS:RECORD = INS:RECORD                                !  Save the Current Record
  1332.     INS:Step = 1                                                !  Prime Field
  1333.                                                                 !
  1334.   OF TCACTION:ChangeRecord                                      !On Change Record
  1335.     SAVE:INS:RECORD = INS:RECORD                                !  Save the Current Record
  1336.                                                                 !
  1337.   OF TCACTION:DeleteRecord                                      !On Delete Record
  1338.     DO DeleteRecord                                             !  Delete the Record
  1339.     GlobalResponse = LocalResponse                              !  Set Global Response
  1340.     RETURN                                                      !  Exit Update Procedure
  1341.   END                                                           !End Case
  1342.                                                                 !
  1343.   ListControl{PROP:NoBar} = 1                                   !Turn Off Point Bar
  1344.                                                                 !
  1345.   LOOP                                                          !Process InLine Actions
  1346.     TC:INL:FirstField = ?INS:Step                               !Set First Field Number
  1347.     TC_InLine(ListControl,InLineFields[],FieldOrder)            !Call InLine Editing
  1348.                                                                 !
  1349.     CASE TC:INL:Action                                          !Process InLine Actions
  1350.     OF TCACTION:SetFields                                       !Set Field Properties Action
  1351.       !--------- ?INS:Instruction ---------
  1352.       ?INS:Instruction{PROP:Use} = INS:Instruction
  1353.       ?INS:Instruction{PROP:Msg} = 'Enter Instructions for this step'
  1354.  
  1355.       !--------- ?INS:Step ---------
  1356.       ?INS:Step{PROP:Use} = INS:Step
  1357.       ?INS:Step{PROP:Msg} = 'Select the Step Number'
  1358.       ?INS:Step{PROP:RangeHigh} = 99
  1359.       ?INS:Step{PROP:RangeLow} = 1
  1360.       ?INS:Step{PROP:Step} = 1
  1361.  
  1362.     OF TCACTION:SetHotKeys                                      !Set Hot Keys Action
  1363.       TC:INL:AbortKey = EscKey                                  !  Set Cancel Key
  1364.       TC:INL:SaveKey = CtrlEnter                                !  Set Save Key
  1365.     
  1366.     OF TCACTION:UpdateRecord                                    !Update Record Action
  1367.       IF SAVE:INS:RECORD = INS:RECORD                           !If the Record was Not Changed
  1368.         LocalResponse = RequestCompleted                        !  Set Local Response to Completed
  1369.         CYCLE                                                   !  Nothing to Save - Exit In-Line
  1370.       END                                                       !End If
  1371.       LOOP                                                      !Attempt to Update Until Done or Canceled
  1372.         Error# = DUPLICATE(INSTRUCTION)                         !  Test For Duplicate Key
  1373.         IF Error#                                               !  If Duplicate Key Error
  1374.           Button# = MESSAGE('Updating this record creates a duplicate entry!', |
  1375.                             'Duplicate Key Error',ICON:Exclamation,Button:OK,Button:OK,0)
  1376.         ELSE                                                    !  Otherwise
  1377.           SETCURSOR(Cursor:Wait)                                !    Show Hour-Glass Cursor
  1378.           IF UpdateAction = TCACTION:InsertRecord               !  If Inserting a New Record
  1379.             ADD(INSTRUCTION)                                    !    Add the Record
  1380.             Error# = ERRORCODE()                                !    Set Error Flag
  1381.           ELSE                                                  !  Otherwise on Updating a Record
  1382.             Error# = RIUpdate:INSTRUCTION()                     !    Attempt Update
  1383.           END                                                   !  End If
  1384.         END                                                     !  End If
  1385.         IF Error#                                               !  If Error Updating
  1386.           SETCURSOR()                                           !    Reset to Normal Cursor
  1387.           Button# = StandardWarning(Warn:UpdateError)           !    Ask If User Wants to Try Saving Again
  1388.           DISPLAY                                               !    Refresh Screen
  1389.           CASE Button#                                          !    Process User Response
  1390.           OF Button:Yes                                         !    On YES Button
  1391.              CYCLE                                              !      Retry Update Operation
  1392.           OF Button:No                                          !    On NO Button
  1393.             BREAK                                               !      Exit without Updating Record
  1394.           OF Button:Cancel                                      !    On Cancel Button
  1395.             TC:INL:AbortUpdate = True                           !      Tell Inline to Cancel Update Request
  1396.             BREAK                                               !      Go back to editing record
  1397.           END                                                   !    End Case
  1398.         END                                                     !  End If
  1399.         SETCURSOR()                                             !  Reset to Normal Cursor
  1400.         LocalResponse = RequestCompleted                        !  Set Local Response to Completed
  1401.         BREAK                                                   !  Exit Update Loop
  1402.       END                                                       !End Loop
  1403.                                                                 !
  1404.     OF TCACTION:AbortUpdate                                     !Abort Update Action
  1405.       IF TC:INL:ResizeWindow THEN CYCLE.                        !Always abort changes on resize
  1406.       IF SAVE:INS:RECORD <> INS:RECORD                          !If the Record was Changed
  1407.         Button# = StandardWarning(Warn:SaveOnCancel)            !  Display Save on Cancel Message
  1408.         DISPLAY                                                 !  Refresh Screen
  1409.         CASE Button#                                            !  Process User Response
  1410.         OF Button:Yes                                           !  On YES Button
  1411.           TC:INL:AbortUpdate = False                            !    Cancel the Request to Abort
  1412.           TC:INL:SelectField = ListControl                      !    Select List to Exit & Save Changes
  1413.         OF Button:No                                            !  On NO Button
  1414.           TC:INL:AbortUpdate = True                             !    Go Ahead and Abandon the Changes
  1415.         OF BUTTON:Cancel                                        !  On Cancel Button
  1416.           TC:INL:AbortUpdate = False                            !    Cancel the Request and Continue
  1417.         END                                                     !  End Case
  1418.       END                                                       !End If
  1419.       IF UpdateAction = TCACTION:InsertRecord                   !If Adding a New Record
  1420.         IF TC:INL:AbortUpdate = True                            !  If Record Add was Aborted
  1421.           DELETE(INSTRUCTION)                                   !    Delete the New Record from the File
  1422.         END                                                     !  End If
  1423.       END                                                       !End If
  1424.                                                                 !
  1425.     OF TCACTION:ExitInLine                                      !Exit InLine Action
  1426.       BREAK                                                     !
  1427.     END                                                         !End Case on Actions
  1428.   END                                                           !End Loop
  1429.                                                                 !
  1430.   GlobalResponse = LocalResponse                                !Set Global Response
  1431.   RETURN                                                        !Exit In-Line Update Procedure
  1432.  
  1433.  
  1434.  
  1435.  
  1436. !--------------------------------------------------------------------------------------------------!
  1437. ! Delete Record Routine                                                                            !
  1438. !                                                                                                  !
  1439. ! This routine Deletes the Record.                                                                 !
  1440. !--------------------------------------------------------------------------------------------------!
  1441. DeleteRecord         ROUTINE
  1442.  
  1443.   LocalResponse = RequestCancelled                              !Default to Request to Delete Cancelled
  1444.                                                                 !
  1445.   Confirm# = StandardWarning(Warn:StandardDelete)               !Get Confirmation from User
  1446.   DISPLAY                                                       !Refresh Screen
  1447.   IF Confirm# <> Button:OK THEN EXIT.                           !If User Did Not Confirm Delete then Exit
  1448.                                                                 !
  1449.   LOOP                                                          !Attempt to Delete Until Done or Canceled
  1450.     SETCURSOR(Cursor:Wait)                                      !  Show Hour-Glass Cursor
  1451.     IF RIDelete:INSTRUCTION()                                   !  If Error Deleting
  1452.       SETCURSOR()                                               !    Reset to Normal Cursor
  1453.       CASE StandardWarning(Warn:DeleteError)                    !    Ask If User Wants to Try Deleting Again
  1454.       OF Button:Yes                                             !    On YES Button
  1455.         CYCLE                                                   !      Retry Delete Operation
  1456.       OF Button:No                                              !    On NO Button
  1457.       OROF Button:Cancel                                        !    Or On Cancel Button
  1458.         BREAK                                                   !      Exit without Deleting Record
  1459.       END                                                       !    End Case
  1460.     END                                                         !  End If
  1461.     SETCURSOR()                                                 !  Reset to Normal Cursor
  1462.     LocalResponse = RequestCompleted                            !  Set Request Completed
  1463.     BREAK                                                       !  Exit Delete Loop
  1464.   END                                                           !End Loop
  1465.  
  1466.  
  1467.  
  1468.  
  1469. !==================================================================================================!
  1470. !                                                                                                  !
  1471. ! BrowseAdvanced:Update:BRWQ4 Procedure                                                            !
  1472. ! ------------------------------------                                                             !
  1473. ! FILE NAME   : MENU                                                                               !
  1474. ! LIST CONTROL: ?List4                                                                             !
  1475. ! FROM QUEUE  : BRWQ4                                                                              !
  1476. !                                                                                                  !
  1477. !==================================================================================================!
  1478. BrowseAdvanced:Update:BRWQ4 PROCEDURE(ListControl,UpdateAction,AbortButton,SaveButton)
  1479.  
  1480. FieldOrder           EQUATE('0,1,2,3,4')                        !Field Order for Sort Order 
  1481.  
  1482. ?MEN:Date            EQUATE(106)                                !Set Field Number for MEN:Date
  1483. ?MOD:MainRcpDsp      EQUATE(107)                                !Set Field Number for MOD:MainRcpDsp
  1484. ?MOD:SideRcpDsp      EQUATE(108)                                !Set Field Number for MOD:SideRcpDsp
  1485. ?MOD:DessertRcpDsp   EQUATE(109)                                !Set Field Number for MOD:DessertRcpDsp
  1486.  
  1487. InLineFieldSetup     GROUP
  1488.                        LONG(CREATE:Entry)                       !Control Type for ?MEN:Date
  1489.                        LONG(CREATE:Entry)                       !Control Type for ?MOD:MainRcpDsp
  1490.                        LONG(CREATE:Entry)                       !Control Type for ?MOD:SideRcpDsp
  1491.                        LONG(CREATE:Entry)                       !Control Type for ?MOD:DessertRcpDsp
  1492.                      END
  1493. InLineFields         LONG,DIM(4),OVER(InLineFieldSetup)
  1494.  
  1495. LocalResponse        LONG,AUTO
  1496. SAVE:MEN:RECORD      STRING(SIZE(MEN:RECORD))
  1497.  
  1498.  
  1499.  
  1500.  
  1501. !--------------------------------------------------------------------------------------------------!
  1502. ! Code Section                                                                                     !
  1503. !--------------------------------------------------------------------------------------------------!
  1504.   CODE
  1505.  
  1506.   LocalResponse = RequestCancelled                              !Default to Request Cancelled
  1507.   CASE UpdateAction                                             !Process Setup for Update Actions
  1508.   OF TCACTION:InsertRecord                                      !On Insert New Record
  1509.     SAVE:MEN:RECORD = MEN:RECORD                                !  Save the Current Record
  1510.                                                                 !
  1511.   OF TCACTION:ChangeRecord                                      !On Change Record
  1512.     SAVE:MEN:RECORD = MEN:RECORD                                !  Save the Current Record
  1513.                                                                 !
  1514.   OF TCACTION:DeleteRecord                                      !On Delete Record
  1515.     DO DeleteRecord                                             !  Delete the Record
  1516.     GlobalResponse = LocalResponse                              !  Set Global Response
  1517.     RETURN                                                      !  Exit Update Procedure
  1518.   END                                                           !End Case
  1519.                                                                 !
  1520.   ListControl{PROP:NoBar} = 1                                   !Turn Off Point Bar
  1521.                                                                 !
  1522.   LOOP                                                          !Process InLine Actions
  1523.     TC:INL:FirstField = ?MEN:Date                               !Set First Field Number
  1524.     TC_InLine(ListControl,InLineFields[],FieldOrder)            !Call InLine Editing
  1525.                                                                 !
  1526.     CASE TC:INL:Action                                          !Process InLine Actions
  1527.     OF TCACTION:SetFields                                       !Set Field Properties Action
  1528.       !--------- ?MEN:Date ---------
  1529.       ?MEN:Date{PROP:Use} = MEN:Date
  1530.       ?MEN:Date{PROP:Req} = 1
  1531.  
  1532.       !--------- ?MOD:DessertRcpDsp ---------
  1533.       ?MOD:DessertRcpDsp{PROP:Use} = MOD:DessertRcpDsp
  1534.  
  1535.       !--------- ?MOD:MainRcpDsp ---------
  1536.       ?MOD:MainRcpDsp{PROP:Use} = MOD:MainRcpDsp
  1537.  
  1538.       !--------- ?MOD:SideRcpDsp ---------
  1539.       ?MOD:SideRcpDsp{PROP:Use} = MOD:SideRcpDsp
  1540.  
  1541.     OF TCACTION:SetHotKeys                                      !Set Hot Keys Action
  1542.       TC:INL:AbortKey = EscKey                                  !  Set Cancel Key
  1543.       TC:INL:SaveKey = CtrlEnter                                !  Set Save Key
  1544.     
  1545.     OF TCACTION:FieldEdits                                      !Process Field Edits Action
  1546.       CASE TC:INL:Field
  1547.       OF ?MOD:MainRcpDsp                            ! OF the Main Dish field
  1548.         CLEAR(RCPALIAS:Record)                      !    clear the Recipe file record
  1549.         RCPALIAS:Code = MOD:MainRcpDsp              !    set the Code to the Main Dish entered
  1550.         GET(RecipeAlias,RCPALIAS:Key_Code)          !    see if the code is a valid recipe code
  1551.         IF ERROR() OR RCPALIAS:Type <> 1            !    IF it is not valid or not a Main Dish recipe
  1552.           TypeFilter = '1'                          !       set the recipe filter type to Main Dish
  1553.           GlobalRequest = SelectRecord              !       set the action for a lookup
  1554.           RcpPosition" = POSITION(RECIPE)           !       Save the current Recipe Postion for DropComboBrowse
  1555.           BrowseBeginning                           !       call the beginning browse as a lookup
  1556.           RCPALIAS:Code = RCP:Code                  !       Set the Alias file to the selected Recipe
  1557.           GET(RecipeAlias,RCPALIAS:Key_Code)        !       Get the Alias record
  1558.           REGET(RECIPE,RcpPosition")                !       Reget the Recipe record for the DropComboBrowse
  1559.           LocalResponse = GlobalResponse            !       save the lookup action for evaluation
  1560.           GlobalResponse = RequestCancelled         !       clear the action
  1561.           IF LocalResponse = RequestCancelled       !       IF no recipe was selected
  1562.             CLEAR(RCPALIAS:Record)                  !          Clear the Recipe file record and
  1563.             TC:INL:AbortUpdate = ?MOD:MainRcpDsp    !          reselect the Main Dish field again
  1564.           END                                       !       END if no recipe selected processing
  1565.         END                                         !   END if  valid code not selected processing
  1566.         MEN:MainRcpNo = RCPALIAS:RecipeNo           ! save the selected Main Recipe to file
  1567.         MOD:MainRcpDsp = RCPALIAS:Code              ! set the Main Recipe display field code
  1568.         DISPLAY(?MOD:MainRcpDsp)                    ! redisplay the Main Recipe display field
  1569.       OF ?MOD:SideRcpDsp                            ! OF the Side Dish field
  1570.         CLEAR(RCPALIAS:Record)                      !    clear the Recipe file record
  1571.         RCPALIAS:Code = MOD:SideRcpDsp              !    set the Code to the Side Dish entered
  1572.         GET(RecipeAlias,RCPALIAS:Key_Code)          !    see if the code is a valid recipe code
  1573.         IF ERROR() OR RCPALIAS:Type <> 2            !    IF it is not valid or not a Side Dish recipe
  1574.           TypeFilter = '2'                          !       set the recipe filter type to Side Dish
  1575.           GlobalRequest = SelectRecord              !       set the action for a lookup
  1576.           RcpPosition" = POSITION(RECIPE)           !       Save the current Recipe Postion for DropComboBrowse!
  1577.           BrowseBeginning                           !       call the beginning browse as a lookup
  1578.           RCPALIAS:Code = RCP:Code                  !       Set the Alias file to the selected Recipe
  1579.           GET(RecipeAlias,RCPALIAS:Key_Code)        !       Get the Alias record
  1580.           REGET(RECIPE,RcpPosition")                !       Reget the Recipe record for the DropComboBrowse
  1581.           LocalResponse = GlobalResponse            !       save the lookup action for evaluation
  1582.           GlobalResponse = RequestCancelled         !       clear the action
  1583.           IF LocalResponse = RequestCancelled       !       IF no recipe was selected
  1584.             CLEAR(RCPALIAS:Record)                  !          Clear the Recipe file record and
  1585.             TC:INL:AbortUpdate = ?MOD:SideRcpDsp    !          reselect the Side Dish field again
  1586.           END                                       !       END if no recipe selected processing
  1587.         END                                         !   END if  valid code not selected processing
  1588.         MEN:SideRcpNo = RCPALIAS:RecipeNo           ! save the selected Side Recipe to file
  1589.         MOD:SideRcpDsp = RCPALIAS:Code              ! set the Side Recipe display field code
  1590.         DISPLAY(?MOD:SideRcpDsp)                    ! redisplay the Side Recipe display field
  1591.       OF ?MOD:DessertRcpDsp                         ! OF the Dessert Dish field
  1592.         CLEAR(RCPALIAS:Record)                      !    clear the Recipe file record
  1593.         RCPALIAS:Code = MOD:DessertRcpDsp           !    set the Code to the Dessert Dish entered
  1594.         GET(RecipeAlias,RCPALIAS:Key_Code)          !    see if the code is a valid recipe code
  1595.         IF ERROR() OR RCPALIAS:Type <> 3            !    IF it is not valid or not a Dessert Dish recipe
  1596.           TypeFilter = '3'                          !       set the recipe filter type to Dessert Dish
  1597.           GlobalRequest = SelectRecord              !       set the action for a lookup
  1598.           RcpPosition" = POSITION(RECIPE)           !       Save the current Recipe Postion for DropComboBrowse!
  1599.           BrowseBeginning                           !       call the beginning browse as a lookup
  1600.           RCPALIAS:Code = RCP:Code                  !       Set the Alias file to the selected Recipe
  1601.           GET(RecipeAlias,RCPALIAS:Key_Code)        !       Get the Alias record
  1602.           REGET(RECIPE,RcpPosition")                !       Reget the Recipe record for the DropComboBrowse
  1603.           LocalResponse = GlobalResponse            !       save the lookup action for evaluation
  1604.           GlobalResponse = RequestCancelled         !       clear the action
  1605.           IF LocalResponse = RequestCancelled       !       IF no recipe was selected
  1606.             CLEAR(RCPALIAS:Record)                  !          Clear the Recipe file record and
  1607.             TC:INL:AbortUpdate = ?MOD:DessertRcpDsp !          reselect the Dessert Dish field again
  1608.           END                                       !       END if no recipe selected processing
  1609.         END                                         !   END if  valid code not selected processing
  1610.         MEN:DessertRcpNo = RCPALIAS:RecipeNo        ! save the selected Dessert Recipe to file
  1611.         MOD:DessertRcpDsp = RCPALIAS:Code           ! set the Dessert Recipe display field code
  1612.         DISPLAY(?MOD:DessertRcpDsp)                 ! redisplay the Dessert Recipe display field
  1613.       END
  1614.     
  1615.     OF TCACTION:UpdateRecord                                    !Update Record Action
  1616.       IF SAVE:MEN:RECORD = MEN:RECORD                           !If the Record was Not Changed
  1617.         LocalResponse = RequestCompleted                        !  Set Local Response to Completed
  1618.         CYCLE                                                   !  Nothing to Save - Exit In-Line
  1619.       END                                                       !End If
  1620.       LOOP                                                      !Attempt to Update Until Done or Canceled
  1621.         Error# = DUPLICATE(MENU)                                !  Test For Duplicate Key
  1622.         IF Error#                                               !  If Duplicate Key Error
  1623.           Button# = MESSAGE('Updating this record creates a duplicate entry!', |
  1624.                             'Duplicate Key Error',ICON:Exclamation,Button:OK,Button:OK,0)
  1625.         ELSE                                                    !  Otherwise
  1626.           SETCURSOR(Cursor:Wait)                                !    Show Hour-Glass Cursor
  1627.           IF UpdateAction = TCACTION:InsertRecord               !  If Inserting a New Record
  1628.             ADD(MENU)                                           !    Add the Record
  1629.             Error# = ERRORCODE()                                !    Set Error Flag
  1630.           ELSE                                                  !  Otherwise on Updating a Record
  1631.             Error# = RIUpdate:MENU()                            !    Attempt Update
  1632.           END                                                   !  End If
  1633.         END                                                     !  End If
  1634.         IF Error#                                               !  If Error Updating
  1635.           SETCURSOR()                                           !    Reset to Normal Cursor
  1636.           Button# = StandardWarning(Warn:UpdateError)           !    Ask If User Wants to Try Saving Again
  1637.           DISPLAY                                               !    Refresh Screen
  1638.           CASE Button#                                          !    Process User Response
  1639.           OF Button:Yes                                         !    On YES Button
  1640.              CYCLE                                              !      Retry Update Operation
  1641.           OF Button:No                                          !    On NO Button
  1642.             BREAK                                               !      Exit without Updating Record
  1643.           OF Button:Cancel                                      !    On Cancel Button
  1644.             TC:INL:AbortUpdate = True                           !      Tell Inline to Cancel Update Request
  1645.             BREAK                                               !      Go back to editing record
  1646.           END                                                   !    End Case
  1647.         END                                                     !  End If
  1648.         SETCURSOR()                                             !  Reset to Normal Cursor
  1649.         LocalResponse = RequestCompleted                        !  Set Local Response to Completed
  1650.         BREAK                                                   !  Exit Update Loop
  1651.       END                                                       !End Loop
  1652.                                                                 !
  1653.     OF TCACTION:AbortUpdate                                     !Abort Update Action
  1654.       IF TC:INL:ResizeWindow THEN CYCLE.                        !Always abort changes on resize
  1655.       IF SAVE:MEN:RECORD <> MEN:RECORD                          !If the Record was Changed
  1656.         Button# = StandardWarning(Warn:SaveOnCancel)            !  Display Save on Cancel Message
  1657.         DISPLAY                                                 !  Refresh Screen
  1658.         CASE Button#                                            !  Process User Response
  1659.         OF Button:Yes                                           !  On YES Button
  1660.           TC:INL:AbortUpdate = False                            !    Cancel the Request to Abort
  1661.           TC:INL:SelectField = ListControl                      !    Select List to Exit & Save Changes
  1662.         OF Button:No                                            !  On NO Button
  1663.           TC:INL:AbortUpdate = True                             !    Go Ahead and Abandon the Changes
  1664.         OF BUTTON:Cancel                                        !  On Cancel Button
  1665.           TC:INL:AbortUpdate = False                            !    Cancel the Request and Continue
  1666.         END                                                     !  End Case
  1667.       END                                                       !End If
  1668.       IF UpdateAction = TCACTION:InsertRecord                   !If Adding a New Record
  1669.         IF TC:INL:AbortUpdate = True                            !  If Record Add was Aborted
  1670.           DELETE(MENU)                                          !    Delete the New Record from the File
  1671.         END                                                     !  End If
  1672.       END                                                       !End If
  1673.                                                                 !
  1674.     OF TCACTION:ExitInLine                                      !Exit InLine Action
  1675.       BREAK                                                     !
  1676.     END                                                         !End Case on Actions
  1677.   END                                                           !End Loop
  1678.                                                                 !
  1679.   GlobalResponse = LocalResponse                                !Set Global Response
  1680.   RETURN                                                        !Exit In-Line Update Procedure
  1681.  
  1682.  
  1683.  
  1684.  
  1685. !--------------------------------------------------------------------------------------------------!
  1686. ! Delete Record Routine                                                                            !
  1687. !                                                                                                  !
  1688. ! This routine Deletes the Record.                                                                 !
  1689. !--------------------------------------------------------------------------------------------------!
  1690. DeleteRecord         ROUTINE
  1691.  
  1692.   LocalResponse = RequestCancelled                              !Default to Request to Delete Cancelled
  1693.                                                                 !
  1694.   Confirm# = StandardWarning(Warn:StandardDelete)               !Get Confirmation from User
  1695.   DISPLAY                                                       !Refresh Screen
  1696.   IF Confirm# <> Button:OK THEN EXIT.                           !If User Did Not Confirm Delete then Exit
  1697.                                                                 !
  1698.   LOOP                                                          !Attempt to Delete Until Done or Canceled
  1699.     SETCURSOR(Cursor:Wait)                                      !  Show Hour-Glass Cursor
  1700.     IF RIDelete:MENU()                                          !  If Error Deleting
  1701.       SETCURSOR()                                               !    Reset to Normal Cursor
  1702.       CASE StandardWarning(Warn:DeleteError)                    !    Ask If User Wants to Try Deleting Again
  1703.       OF Button:Yes                                             !    On YES Button
  1704.         CYCLE                                                   !      Retry Delete Operation
  1705.       OF Button:No                                              !    On NO Button
  1706.       OROF Button:Cancel                                        !    Or On Cancel Button
  1707.         BREAK                                                   !      Exit without Deleting Record
  1708.       END                                                       !    End Case
  1709.     END                                                         !  End If
  1710.     SETCURSOR()                                                 !  Reset to Normal Cursor
  1711.     LocalResponse = RequestCompleted                            !  Set Request Completed
  1712.     BREAK                                                       !  Exit Delete Loop
  1713.   END                                                           !End Loop
  1714.  
  1715.  
  1716.  
  1717.  
  1718.