home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-23 | 117.7 KB | 1,718 lines |
- MEMBER('DEMO.clw') ! This is a MEMBER module
- MAP
- BrowseAdvanced:Update:BRWQ2(LONG,LONG,<LONG>,<BYTE>,<BYTE>)
- END
- MAP
- BrowseAdvanced:Update:BRWQ3(LONG,LONG,<BYTE>,<BYTE>)
- END
- MAP
- BrowseAdvanced:Update:BRWQ4(LONG,LONG,<BYTE>,<BYTE>)
- END
- MOD:DessertRcpDsp STRING(5)
- MOD:SideRcpDsp STRING(5)
- MOD:MainRcpDsp STRING(5)
-
-
-
-
- BrowseAdvanced PROCEDURE
-
- !--------------------------------------------------------------------------------------------------!
- ! Declarations !
- !--------------------------------------------------------------------------------------------------!
- LocalRequest LONG,AUTO
- LocalResponse LONG,AUTO
- WindowOpened LONG
- Search STRING(40)
- MarkStatus STRING(15)
- Search2 STRING(20)
- Search4 STRING(10)
- MarkStatus4 STRING(1)
- OriginalRequest LONG,AUTO
- WindowInitialized LONG
- ForceRefresh LONG,AUTO
- LOC:SelectedRcpName STRING(20)
- InLineActive BYTE(1)
- WinWidth LONG(334) ! Save Window Width for Resizing
- WinHeight LONG(174) ! Save Window Height for Resizing
- CurrentSelected LONG,AUTO ! Save Current Selected Field
-
- CMBSAV18:RCP:Name LIKE(RCP:Name) ! Combo Save Field Value for Restore
- FORMAT:BRWQ2:Default EQUATE('60L|_~Ingredient~@S15@32L|_~Measure~@S8@8L|_~Quantity~@s5@')
- FORMAT:BRWQ2:Order2 EQUATE('32L(1)|_~Measure~@S8@#2#24L(1)|_~Qty~@S5@60L(1)|_~Ingredient~@S15@#1#')
-
- SQ7:SortOrder BYTE !Current Sort Order for the List Box
- CWTabOrderQ:BRWQ2 QUEUE,PRE(SQ7) !Queue Use to Store Sort Order Info
- OrderName STRING(60) ! Description shown in drop box
- SearchPicture STRING(30) ! Picture Clause for Search Field
- OrderFormat STRING(500) ! Format String for the List Box
- END !End Queue Declaration
-
- FORMAT:BRWQ3:Default EQUATE('18L(1)|_~Step~@N2@80L(1)|_~Instruction~@S20@')
-
- FORMAT:BRWQ4:Default EQUATE('10L(1)|_@s1@39L(1)|_~Date~@D1@28L(1)|_~Main~@s5@29L(1)|_~Side~@s5@20L(1)|_~Dessert~@s5@')
-
- MarkAllFlag4 BYTE !Flag Indicating All Records Marked
- MarkQueue4 QUEUE,PRE(MQ11) !Queue Used to Store Marked Records
- Date LIKE(MEN:Date),NAME('TC_MarkKey') ! Unique Record Id for the File
- END !End Queue Declaration
-
-
- BRWQ QUEUE !Queue Used by List when Browsing Records
- RCP:Name LIKE(RCP:Name) ! Queue Display Field
- Position STRING(255) ! Queue POSITION Information
- END !End Queue Declaration
-
- BRWQ2 QUEUE !Queue Used by List when Browsing Records
- ING:Ingredient LIKE(ING:Ingredient) ! Queue Display Field
- ING:Measure LIKE(ING:Measure) ! Queue Display Field
- ING:Quantity LIKE(ING:Quantity) ! Queue Display Field
- Position STRING(255) ! Queue POSITION Information
- END !End Queue Declaration
-
- BRWQ3 QUEUE !Queue Used by List when Browsing Records
- INS:Step LIKE(INS:Step) ! Queue Display Field
- INS:Instruction LIKE(INS:Instruction) ! Queue Display Field
- Position STRING(255) ! Queue POSITION Information
- END !End Queue Declaration
-
- BRWQ4 QUEUE !Queue Used by List when Browsing Records
- MarkStatus4 LIKE(MarkStatus4) ! Queue Display Field
- MEN:Date LIKE(MEN:Date) ! Queue Display Field
- MOD:MainRcpDsp LIKE(MOD:MainRcpDsp) ! Queue Display Field
- MOD:SideRcpDsp LIKE(MOD:SideRcpDsp) ! Queue Display Field
- MOD:DessertRcpDsp LIKE(MOD:DessertRcpDsp) ! Queue Display Field
- Position STRING(255) ! Queue POSITION Information
- END !End Queue Declaration
- RevOrder:BRWQ4 BYTE(1)
-
-
- Screen WINDOW('Advanced Browse Exercise'),AT(,,334,174),FONT('MS Sans Serif',8,,),CENTER,STATUS,SYSTEM,GRAY,MAX,RESIZE,MDI,IMM
- SHEET,AT(6,18,155,85),USE(?ChangeOrder)
- TAB('By Ingredient'),USE(?Tab1)
- END
- TAB('By Measure'),USE(?Tab2)
- END
- END
- 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)
- COMBO(@s20),AT(60,3,102,10),USE(LOC:SelectedRcpName),IMM,VSCROLL,FORMAT('80L~Name~@S20@'),DROP(6),FROM(BRWQ)
- PROMPT('Search:'),AT(11,34,25,10),USE(?Search:Prompt:1)
- ENTRY(@S40),AT(39,34,80,10),MSG('Enter Search Criteria'),USE(Search2)
- 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)
- BUTTON('Insert'),AT(22,87,40,10),USE(?Insert)
- BUTTON('Change'),AT(61,87,40,10),USE(?Change)
- BUTTON('Delete'),AT(101,87,40,10),USE(?Delete)
- BUTTON('Insert'),AT(183,150,40,10),USE(?Insert:2)
- BUTTON('Change'),AT(223,150,40,10),USE(?Change:2)
- BUTTON('Delete'),AT(263,150,40,10),USE(?Delete:2)
- BUTTON('InLine On/Off'),AT(183,161,120,10),USE(?InLineToggle)
- BUTTON('Insert'),AT(22,148,40,10),USE(?Insert:3)
- BUTTON('Change'),AT(62,148,40,10),USE(?Change:3)
- BUTTON('Delete'),AT(102,148,40,10),USE(?Delete:3)
- 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)
- PROMPT('Search:'),AT(175,4,25,10),USE(?Search:Prompt:2)
- ENTRY(@D1),AT(203,4,71,10),MSG('Enter Search Criteria'),USE(Search4),OVR
- 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)
- PROMPT('Recipe Name:'),AT(8,4,50,10),USE(?Prompt3)
- BUTTON('Close'),AT(302,5,28,10),USE(?Close)
- BUTTON('&Mark'),AT(171,29,40,10),USE(?Mark:1),HIDE
- BUTTON('&Unmark'),AT(171,37,40,10),USE(?Unmark:1),HIDE
- BUTTON('Mark &All'),AT(171,46,40,10),USE(?MarkAll:1),HIDE
- BUTTON('&Clear All'),AT(171,53,40,10),USE(?UnmarkAll:1),HIDE
- END
-
-
- !--------------------------------------------------------------------------------------------------!
- ! Code Section !
- !--------------------------------------------------------------------------------------------------!
- CODE
-
- LocalRequest = GlobalRequest
- OriginalRequest = LocalRequest
- LocalResponse = RequestCancelled
- ForceRefresh = False
- CLEAR(GlobalRequest)
- CLEAR(GlobalResponse)
-
- IF INGREDIENT::Used = 0
- CheckOpen(INGREDIENT,1)
- END
- INGREDIENT::Used += 1
- IF INSTRUCTION::Used = 0
- CheckOpen(INSTRUCTION,1)
- END
- INSTRUCTION::Used += 1
- IF MENU::Used = 0
- CheckOpen(MENU,1)
- END
- MENU::Used += 1
- IF RECIPE::Used = 0
- CheckOpen(RECIPE,1)
- END
- RECIPE::Used += 1
- IF RecipeAlias::Used = 0
- CheckOpen(RecipeAlias,1)
- END
- RecipeAlias::Used += 1
- CLEAR(RCP:Record)
- SET(RCP:Key_Name)
- NEXT(RECIPE)
- LOC:SelectedRcpName = RCP:Name
-
- OPEN(Screen)
- WindowOpened = True
- INIRestoreWindow('BrowseAdvanced','PTDEMO.INI')
- DO ResizeWindow !Call Resize Window Routine
- Screen{PROP:Imm} = 1 !Allow Resize Events to be Posted
- HIDE(?List2) !Delay Display of List Box
- HIDE(?List3) !Delay Display of List Box
- HIDE(?List4) !Delay Display of List Box
- ?InLineToggle{PROP:Text} = 'Using In-Line Editing'
- DO LoadSortOrders:BRWQ2
- SELECT(?List2)
-
-
- ACCEPT !Begin Processing Event Loop
- !
- IF SELECTED() THEN CurrentSelected = SELECTED(). !Save Current Field Selection
- CASE EVENT() !Process Events for the Window
- OF EVENT:OpenWindow
- IF NOT WindowInitialized
- DO InitializeWindow
- WindowInitialized = True
- END
- SELECT(FIRSTFIELD())
- UNHIDE(?List2) !Unhide Filled List Box
- UNHIDE(?List3) !Unhide Filled List Box
- UNHIDE(?List4) !Unhide Filled List Box
- OF EVENT:GainFocus
- IF NOT WindowInitialized
- WindowInitialized = True
- DO InitializeWindow
- ELSE
- ForceRefresh = True
- DO RefreshWindow
- END
- ELSE
- IF EVENT() = EVENT:Sized !IF Window Was Resized
- DO ResizeWindow ! Call Resize Window Routine
- END !End If
- END !End Events for Window
-
- CASE FIELD() !Process Events for Controls
- OF ?ChangeOrder
- CASE EVENT()
- OF EVENT:NewSelection
- GET(CWTabOrderQ:BRWQ2,CHOICE()) !Get Order settings from Sort Orders Queue
- IF NOT ERROR() !IF Valid Choice was Selected
- SQ7:SortOrder = CHOICE() ! Set sort order
- ?Search2{PROP:Text} = SQ7:SearchPicture ! Set Picture for Search Field
- ?List2{PROP:Format} = SQ7:OrderFormat ! Set number of rows in list box
- TC_PROP:BRW(?List2,TCPROP:Rows,?List2{PROP:Items}) ! Reset number of rows property
- TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to start redisplay with a search by key
- TC_PROP:BRW(?List2,TCPROP:SetToPosition,2) ! Set Redisplay at Key Position from Queue
- DO BrowseList:BRWQ2 ! Call BrowseList and Execute Redisplay
- END !End
- END
- OF ?List2
- CASE EVENT()
- OF EVENT:AlertKey
- DO StepSearch:BRWQ2
- END
- DO BrowseCombo:BRWQ ! Fill Browse Area
- IF EVENT() <> EVENT:AlertKey AND | !If Not an Alert Key or a
- EVENT() <> EVENT:PreAlertKey AND | ! Pre-Alert Key Event and
- EVENT() <> EVENT:Selected ! Control not reselected
- Search2 = '' ! Clear the Search Input Field
- DISPLAY(?Search2) ! Display Locator Field
- END !End If
- DO BrowseList:BRWQ2 !Fill Browse Area
- OF ?LOC:SelectedRcpName
- CASE EVENT()
- OF EVENT:Accepted
- IF NOT TARGET{PROP:AcceptAll} AND NOT TC_PROP:BRW(?LOC:SelectedRcpName,TCPROP:DroppedDown)
- POST(TCEVENT:AcceptSelection,?LOC:SelectedRcpName)
- END
- DO AddComboRecord:BRWQ
- CYCLE
- OF EVENT:NewSelection
- DO AutoFillSearch:BRWQ
- CYCLE
- OF EVENT:DroppingDown
- CMBSAV18:RCP:Name = RCP:Name ! Save Copy of Current Combo Value
- RCP:Name = LOC:SelectedRcpName
- SET(RCP:Key_Name,RCP:Key_Name)
- NEXT(RECIPE)
- TC_PROP:BRW(?LOC:SelectedRcpName,TCPROP:Action,TCACTION:Refresh)
- TC_PROP:BRW(?LOC:SelectedRcpName,TCPROP:SetToPosition,1)
- ELSE
- IF EVENT() = TCEVENT:RejectSelection !If Combo Field Selection was Rejected
- POST(TCEVENT:AcceptSelection,?LOC:SelectedRcpName) ! Force Accept Before Window Refresh
- END !End
- IF EVENT() = TCEVENT:AcceptSelection !If Combo Field Selection was Made
- DO RefreshWindow ! Force Window Refresh
- END !End
- END
- DO BrowseCombo:BRWQ ! Fill Browse Area
- OF ?Search2
- CASE EVENT()
- OF EVENT:Accepted
- DO EntrySearch:BRWQ2
- END
- OF ?List3
- DO BrowseCombo:BRWQ ! Fill Browse Area
- DO BrowseList:BRWQ3 !Fill Browse Area
- OF ?Insert
- CASE EVENT()
- OF EVENT:Accepted
- POST(TCEVENT:InsertRecord,?List2) !Send Insert Message to List Box
- END
- OF ?Change
- CASE EVENT()
- OF EVENT:Accepted
- POST(TCEVENT:ChangeRecord,?List2) !Send Change Message to List Box
- END
- OF ?Delete
- CASE EVENT()
- OF EVENT:Accepted
- POST(TCEVENT:DeleteRecord,?List2) !Send Delete Message to List Box
- END
- OF ?Insert:2
- CASE EVENT()
- OF EVENT:Accepted
- POST(TCEVENT:InsertRecord,?List4) !Send Insert Message to List Box
- END
- OF ?Change:2
- CASE EVENT()
- OF EVENT:Accepted
- POST(TCEVENT:ChangeRecord,?List4) !Send Change Message to List Box
- END
- OF ?Delete:2
- CASE EVENT()
- OF EVENT:Accepted
- POST(TCEVENT:DeleteRecord,?List4) !Send Delete Message to List Box
- END
- OF ?InLineToggle
- CASE EVENT()
- OF EVENT:Accepted
- IF InLineActive
- ?InLineToggle{PROP:Text} = 'Using Form Editing'
- InLineActive = 0
- ELSE
- ?InLineToggle{PROP:Text} = 'Using In-Line Editing'
- InLineActive = 1
- END
- SELECT(TC:BRW:ActiveList)
- END
- OF ?Insert:3
- CASE EVENT()
- OF EVENT:Accepted
- POST(TCEVENT:InsertRecord,?List3) !Send Insert Message to List Box
- END
- OF ?Change:3
- CASE EVENT()
- OF EVENT:Accepted
- POST(TCEVENT:ChangeRecord,?List3) !Send Change Message to List Box
- END
- OF ?Delete:3
- CASE EVENT()
- OF EVENT:Accepted
- POST(TCEVENT:DeleteRecord,?List3) !Send Delete Message to List Box
- END
- OF ?List4
- CASE EVENT()
- OF EVENT:Locate
- SELECT(?Search4) !Select Locator Field
- OF EVENT:AlertKey
- CASE KEYCODE() !Process Alert Keys for Marking
- OF SpaceKey ! On Mark/Unmark Key
- GET(BRWQ4,CHOICE(?List4)) ! Reget Current Record ID
- MQ11:Date = BRWQ4:MEN:Date ! Prepare to Search for Marked Record
- GET(MarkQueue4,MQ11:Date) ! See if Record is Marked
- IF (ERROR() AND NOT MarkAllFlag4) OR | !
- (NOT ERROR() AND MarkAllFlag4) ! IF Record is Not Marked
- POST(EVENT:Accepted,?Mark:1) ! Mark the Record
- ELSE ! Otherwise
- POST(EVENT:Accepted,?Unmark:1) ! Unmark the Record
- END ! End If
- CYCLE ! Cycle to Top of Event Loop
- OF ShiftSpace ! On MarkAll/UnMarkAll Key
- IF NOT MarkAllFlag4 ! If Not All Records Marked Before
- POST(EVENT:Accepted,?MarkAll:1) ! Mark All Records
- ELSE ! Otherwise
- POST(EVENT:Accepted,?UnmarkAll:1) ! Unmark All Records
- END ! End If
- CYCLE ! Cycle to Top of Event Loop
- END !End Case
- END
- DO BrowseCombo:BRWQ ! Fill Browse Area
- IF EVENT() <> EVENT:AlertKey AND | !If Not an Alert Key or a
- EVENT() <> EVENT:PreAlertKey AND | ! Pre-Alert Key Event and
- EVENT() <> EVENT:Selected ! Control not reselected
- Search4 = '' ! Clear the Search Input Field
- DISPLAY(?Search4) ! Display Locator Field
- END !End If
- DO BrowseList:BRWQ4 !Fill Browse Area
- OF ?Search4
- CASE EVENT()
- OF EVENT:Accepted
- DO EntrySearch:BRWQ4
- END
- OF ?PrintMenu
- CASE EVENT()
- OF EVENT:Accepted
- IF RECORDS(MarkQueue4)
- TC:BRW:ProcessMarked = True
- TC:BRW:MarkQueue &= MarkQueue4
- TC:BRW:MarkAllFlag = MarkAllFlag4
- ELSE
- TC:BRW:ProcessMarked = False
- END
- START(PrintMenu,25000)
- LocalRequest = OriginalRequest
- DO RefreshWindow
- END
- OF ?Close
- CASE EVENT()
- OF EVENT:Accepted
- LocalResponse = RequestCancelled
- POST(Event:CloseWindow)
- END
- OF ?Mark:1
- CASE EVENT()
- OF EVENT:Accepted
- GET(BRWQ4,CHOICE(?List4)) !Reget Current Record ID
- MQ11:Date = BRWQ4:MEN:Date !Prepare to Search for Marked Record
- GET(MarkQueue4,MQ11:Date) !See if Record is Marked
- IF NOT MarkAllFlag4 !If Not Marking All Exceptions
- IF ERROR() ! If Record Not Marked
- BRWQ4:MarkStatus4 = 'X' ! Show Record as Marked in the List Box
- MQ11:Date = BRWQ4:MEN:Date ! Set up to Add Record to the Mark Queue
- ADD(MarkQueue4,MQ11:Date) ! Add the Record to the Mark Queue
- PUT(BRWQ4) ! Update the Changes to the List Box
- END ! End If
- ELSE !Otherwise Mark Table is an Exception List
- IF NOT ERROR() ! If Record Not Marked
- BRWQ4:MarkStatus4 = 'X' ! Show Record as Marked in the List Box
- DELETE(MarkQueue4) ! Delete the Record from the Mark Queue
- PUT(BRWQ4) ! Update the Changes to the List Box
- END ! End If
- END !End If
- POST(EVENT:ScrollDown,?List4) !Go Back to List and Move Down 1 Record
- END
- OF ?Unmark:1
- CASE EVENT()
- OF EVENT:Accepted
- GET(BRWQ4,CHOICE(?List4)) !Reget Current Record ID
- MQ11:Date = BRWQ4:MEN:Date !Prepare to Search for Marked Record
- GET(MarkQueue4,MQ11:Date) !See if Record is Marked
- IF NOT MarkAllFlag4 !If Not Marking All Exceptions
- IF NOT ERROR() ! If Record is Marked
- BRWQ4:MarkStatus4 = '' ! Show Record as Not Marked in the List Box
- DELETE(MarkQueue4) ! Delete the Record from the Mark Queue
- PUT(BRWQ4) ! Update the Changes to the List Box
- END ! End If
- ELSE !Otherwise Mark Table is an Exception List
- IF ERROR() ! If Record is Marked
- BRWQ4:MarkStatus4 = '' ! Show Record as Not Marked in the List Box
- MQ11:Date = BRWQ4:MEN:Date ! Set up to Add Record to the Mark Queue
- ADD(MarkQueue4,MQ11:Date) ! Add the Record to the Mark Queue
- PUT(BRWQ4) ! Update the Changes to the List Box
- END ! End If
- END !End If
- POST(EVENT:ScrollDown,?List4) !Go Back to List and Move Down 1 Record
- END
- OF ?MarkAll:1
- CASE EVENT()
- OF EVENT:Accepted
- MarkAllFlag4 = 1 !Mark Queue is Now an Exception List
- FREE(MarkQueue4) !Mark All Records
- LOOP Rec# = 1 TO RECORDS(BRWQ4) !Loop Through the List Boxes Records
- GET(BRWQ4,Rec#) ! Read the Queue Record
- BRWQ4:MarkStatus4 = 'X' ! Show Record as Marked in the List Box
- PUT(BRWQ4) ! Update the Changes to the List Box
- END !End Loop
- SELECT(?List4) !Go Back to List Box After Button Press
- END
- OF ?UnmarkAll:1
- CASE EVENT()
- OF EVENT:Accepted
- MarkAllFlag4 = 0 !Mark Queue is Now a List of Marked Records
- FREE(MarkQueue4) !UnMark All Records
- LOOP Rec# = 1 TO RECORDS(BRWQ4) !Loop Through the List Boxes Records
- GET(BRWQ4,Rec#) ! Read the Queue Record
- BRWQ4:MarkStatus4 = '' ! Show Record as Not Marked in the List Box
- PUT(BRWQ4) ! Update the Changes to the List Box
- END !End Loop
- SELECT(?List4) !Go Back to List Box After Button Press
- END
- END !End Events for Controls
- END !End Event Loop
- !
- DO ProcedureReturn !Cleanup and Exit the Procedure
-
-
- !--------------------------------------------------------------------------------------------------!
- ! InitializeWindow Routine !
- ! !
- ! Initialize and Display window for the first time. !
- !--------------------------------------------------------------------------------------------------!
- InitializeWindow ROUTINE
- DO RefreshWindow
-
-
- !--------------------------------------------------------------------------------------------------!
- ! RefreshWindow Routine !
- ! !
- ! Redisplays the fields for the window. !
- !--------------------------------------------------------------------------------------------------!
- RefreshWindow ROUTINE
-
- IF Screen{Prop:AcceptAll} THEN EXIT.
- DO BrowseCombo:BRWQ
- TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh)
- TC_PROP:BRW(?List2,TCPROP:SetToItem,CHOICE(?List2))
- TC_PROP:BRW(?List2,TCPROP:DontSelect,True)
- DO BrowseList:BRWQ2
- TC_PROP:BRW(?List3,TCPROP:Action,TCACTION:Refresh)
- TC_PROP:BRW(?List3,TCPROP:SetToItem,CHOICE(?List3))
- TC_PROP:BRW(?List3,TCPROP:DontSelect,True)
- DO BrowseList:BRWQ3
- TC_PROP:BRW(?List4,TCPROP:Action,TCACTION:Refresh)
- TC_PROP:BRW(?List4,TCPROP:SetToItem,CHOICE(?List4))
- TC_PROP:BRW(?List4,TCPROP:DontSelect,True)
- DO BrowseList:BRWQ4
- DISPLAY()
- ForceRefresh = False
-
-
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! ResizeWindow Routine !
- ! !
- ! Resize the Window and Redsiplay any list boxes that were resized.Resized List Boxes !
- !--------------------------------------------------------------------------------------------------!
- ResizeWindow ROUTINE
-
- IF WinWidth = Screen{PROP:Width} AND | !If Window Width was not Changed AND
- WinHeight = Screen{PROP:Height} ! Window Height was not Changed
- EXIT ! Resize Not Needed - Exit Routine
- END !End If
- !
- TC_ResizeWin(?List4,WinWidth,WinHeight,?List3) !Reset Window Size
- WinWidth = Screen{PROP:Width} !Save Current Window Width
- WinHeight = Screen{PROP:Height} !Save Current Window Height
- !
- IF NOT WindowInitialized THEN EXIT. !Refresh not needed if window not Init.
- !
- TC_PROP:BRW(?List3,TCPROP:Rows,?List3{PROP:Items}) !Reset Number of Rows in List Box
- TC_PROP:BRW(?List3,TCPROP:SetToPosition,3) !Set for Redisplay at Key Position
- TC_PROP:BRW(?List3,TCPROP:Action,TCACTION:Refresh) !Tell Browse to Redisplay
- DO BrowseList:BRWQ3 !Fill Browse Area
- !
- TC_PROP:BRW(?List4,TCPROP:Rows,?List4{PROP:Items}) !Reset Number of Rows in List Box
- TC_PROP:BRW(?List4,TCPROP:SetToPosition,3) !Set for Redisplay at Key Position
- TC_PROP:BRW(?List4,TCPROP:Action,TCACTION:Refresh) !Tell Browse to Redisplay
- DO BrowseList:BRWQ4 !Fill Browse Area
- !
- IF CurrentSelected THEN SELECT(CurrentSelected). !Reslect Current Field
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! BrowseCombo:BRWQ Routine !
- ! !
- ! This routine calls the browser to do a page-loaded combo display from a file. !
- !--------------------------------------------------------------------------------------------------!
- BrowseCombo:BRWQ ROUTINE
-
- IF EVENT() = TCEVENT:RejectSelection OR | !If User Rejected Combo Selection OR
- NOT TC_PROP:BRW(?LOC:SelectedRcpName,TCPROP:Initialized) ! Browse Not Intialized
- IF EVENT() = TCEVENT:RejectSelection ! If User Rejected Combo Selection
- RCP:Name = CMBSAV18:RCP:Name ! Restore to Value Before Dropping Down
- END ! End If
- CLEAR(RCP:RECORD) ! Clear Record Area
- RCP:Name = LOC:SelectedRcpName ! Set Lookup Key Value
- GET(RECIPE,RCP:Key_Name) ! Get Current Record
- LOC:SelectedRcpName = RCP:Name ! Set Combo Field Value
- DISPLAY(?LOC:SelectedRcpName) ! Redisplay Combo Field
- END !End If
-
- IF EVENT() = TCEVENT:AcceptSelection !If User Accepted combo Selection
- LOC:SelectedRcpName = RCP:Name ! Set Related Combo Field
- LOC:SelectedRcpName = RCP:Name ! Set Combo Field Value
- DISPLAY(?LOC:SelectedRcpName) ! Redisplay Combo Field
- ?LOC:SelectedRcpName{PROP:Touched}=FALSE ! Set Field as Changed
- END !End If
-
- IF NOT TC_PROP:BRW(?LOC:SelectedRcpName,TCPROP:Initialized) !If Browse Not Initialized
- IF NOT TC_InitBrowse(?LOC:SelectedRcpName,THREAD()) THEN EXIT. ! Initialize Browse Processing for List Box
- END !End If
- !
- IF NOT TC_PROP:BRW(?LOC:SelectedRcpName,TCPROP:DroppedDown) !If Combo is Not Dropped Down
- EXIT ! Don't Call Browse Procedure
- END !End
- !
- LOOP !Process File Browse Loop
- TC_Browse(?LOC:SelectedRcpName ,| ! Browse Handle
- RECIPE ,| ! File Name
- RCP:RECORD ,| ! Record Area
- RCP:Key_Name ,| ! Key Order for Display
- BRWQ ,| ! Queue Name for List
- BRWQ:Position ) ! Record Position in Key Order
-
- CASE TC_PROP:BRW(?LOC:SelectedRcpName,TCPROP:Action) !Process Browse Actions
- OF TCACTION:FillQueue !Fill List Queue Action
- BRWQ:RCP:Name = RCP:Name ! Move Data to Queue
- !
- OF TCACTION:ExitBrowse !Exit Browse Action
- BREAK !
- END !End Process Browse Actions
- END !End Process File Browse Loop
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! AutoFillSearch:BRWQ Routine !
- ! !
- ! This routine processes a auto fill search for ?LOC:SelectedRcpName !
- !--------------------------------------------------------------------------------------------------!
- AutoFillSearch:BRWQ ROUTINE
-
- IF TC_PROP:BRW(?LOC:SelectedRcpName,TCPROP:DroppedDown) THEN EXIT. !Don't Search if Combo is Dropped Down
-
- TC_AutoFill(RECIPE ,| !File Name
- RCP:RECORD ,| !Record Area
- RCP:Key_Name ,| !Key Order for Display
- RCP:Name ,| !Field to Lookup
- LOC:SelectedRcpName ,| !Entry Field to Fill
- False ) !Disable Record Filtering
- ?LOC:SelectedRcpName{PROP:Touched} = True !Set Entry Field as Changed
- LOC:SelectedRcpName = RCP:Name ! Set Related Combo Field
-
-
- !--------------------------------------------------------------------------------------------------!
- ! AddComboRecord:BRWQ Routine !
- ! !
- ! This routine adds a new record for a drop combo. !
- !--------------------------------------------------------------------------------------------------!
- AddComboRecord:BRWQ ROUTINE
-
- IF NOT LOC:SelectedRcpName THEN EXIT.
- RCP:Name = LOC:SelectedRcpName
- GET(RECIPE,RCP:Key_Name)
- IF NOT ERRORCODE() THEN EXIT.
-
- BEEP(1)
-
- Button# = MESSAGE('Would you like to add a new record?', |
- 'Record Not On File',|
- ICON:Question,BUTTON:Yes+BUTTON:No)
-
- IF Button# = BUTTON:Yes
- GET(RECIPE,0)
- CLEAR(RCP:RECORD)
- RCP:Name = LOC:SelectedRcpName
- GlobalRequest = InsertRecord
- UpdateRecipe
- IF GlobalResponse = RequestCompleted
- LOC:SelectedRcpName = RCP:Name ! Set Related Combo Field
- DISPLAY(?LOC:SelectedRcpName)
- POST(EVENT:Accepted,?LOC:SelectedRcpName)
- EXIT
- END
- END
-
- CLEAR(LOC:SelectedRcpName)
- SELECT(?LOC:SelectedRcpName)
- ?LOC:SelectedRcpName{PROP:Touched} = True
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! BrowseList:BRWQ2 Routine !
- ! !
- ! This routine calls the browser to do a page-loaded display from a file. !
- !--------------------------------------------------------------------------------------------------!
- BrowseList:BRWQ2 ROUTINE
-
- IF NOT TC_PROP:BRW(?List2,TCPROP:Initialized) !If Browse Not Initialized
- IF NOT TC_InitBrowse(?List2,THREAD()) THEN EXIT. ! Initialize Browse Processing for List Box
- TC_PROP:BRW(?List2,TCPROP:InsertMode,1) ! Set Insert Mode to Top of List
- IF LocalRequest = SelectRecord ! If Browse Procedure Called as a Lookup
- TC_PROP:BRW(?List2,TCPROP:SetToPosition,1) ! Start Lookup on Current Record
- TC_PROP:BRW(?List2,TCPROP:SelectRecord,True) ! Set Double Click to Select Record
- END ! End If
- END !End If
- !
- LOOP !Process File Browse Loop
- CASE SQ7:SortOrder !Browse for Current Sort Order
- OF 1 !Sort Order Is By Ingredient
- TC_Browse(?List2 ,| ! Browse Handle
- INGREDIENT ,| ! File Name
- ING:RECORD ,| ! Record Area
- ING:Key_Ingredient ,| ! Key Order for Display
- BRWQ2 ,| ! Queue Name for List
- BRWQ2:Position ,| ! Record Position in Key Order
- ING:RecipeNo ,| ! Range Field
- RCP:RecipeNo ,| ! Match Range - Low Value
- RCP:RecipeNo ) ! Match Range - High Value
- OF 2 !Sort Order Is By Measure
- TC_Browse(?List2 ,| ! Browse Handle
- INGREDIENT ,| ! File Name
- ING:RECORD ,| ! Record Area
- ING:Key_Measure ,| ! Key Order for Display
- BRWQ2 ,| ! Queue Name for List
- BRWQ2:Position ,| ! Record Position in Key Order
- ING:RecipeNo ,| ! Range Field
- RCP:RecipeNo ,| ! Match Range - Low Value
- RCP:RecipeNo ) ! Match Range - High Value
- END !End Case On Sort Orders
-
- CASE TC_PROP:BRW(?List2,TCPROP:Action) !Process Browse Actions
- OF TCACTION:FillQueue !Fill List Queue Action
- MQ11:Date = MEN:Date ! Prepare to Search for Marked Record
- GET(MarkQueue4,MQ11:Date) ! See if Record is Marked
- IF (NOT MarkAllFlag4 AND NOT ERROR()) OR | ! If Record is Marked
- (MarkAllFlag4 AND ERROR()) !
- MarkStatus4 = 'X' ! Show Record as Marked
- ELSE ! Otherwise
- MarkStatus4 = '' ! Show Record as Not Marked
- END ! End If
- BRWQ2:ING:Ingredient = ING:Ingredient ! Move Data to Queue
- BRWQ2:ING:Measure = ING:Measure ! Move Data to Queue
- BRWQ2:ING:Quantity = ING:Quantity ! Move Data to Queue
- !
- OF TCACTION:InsertRecord !Insert Record Action
- GET(INGREDIENT,0) ! Clear Pending Record
- CLEAR(ING:RECORD) ! Clear Record Area
- DISABLE(?ChangeOrder) ! Disable Change Order Control
- BrowseAdvanced:Update:BRWQ2(?List2,TCACTION:InsertRecord,SQ7:SortOrder) ! Call In-Line Update Procedure
- ENABLE(?ChangeOrder) ! Enable Change Order Control
- IF GlobalResponse = RequestCompleted ! If Update Completed
- TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List2,TCPROP:SetToPosition,2) ! Record at the current positon
- ELSE ! Otherwise
- DELETE(BRWQ2) ! Delete Cancelled Queue Record
- POST(EVENT:ScrollTop,?List2) ! Redisplay First Page of Records
- END ! End If
- !
- OF TCACTION:ChangeRecord !Change Record Action
- DISABLE(?ChangeOrder) ! Disable Change Order Control
- BrowseAdvanced:Update:BRWQ2(?List2,TCACTION:ChangeRecord,SQ7:SortOrder) ! Call In-Line Update Procedure
- ENABLE(?ChangeOrder) ! Enable Change Order Control
- TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List2,TCPROP:SetToPosition,2) ! Record at the current positon
- !
- OF TCACTION:DeleteRecord !Delete Record Action
- DISABLE(?ChangeOrder) ! Disable Change Order Control
- BrowseAdvanced:Update:BRWQ2(?List2,TCACTION:DeleteRecord,SQ7:SortOrder) ! Call In-Line Update Procedure
- ENABLE(?ChangeOrder) ! Enable Change Order Control
- TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List2,TCPROP:SetToItem,True) ! Record at the current positon
- !
- OF TCACTION:SelectRecord !Select Record Action
- LocalResponse = RequestCompleted ! Lookup was completed
- POST(Event:CloseWindow) ! Return Selected Record to Caller
- !
- OF TCACTION:DisplayFields !Display Fields Action
- IF RECORDS(BRWQ2) ! If Records Displayed
- ENABLE(?Change) ! Enable Change Button
- ENABLE(?Delete) ! Enable Delete Button
- ELSE ! Else
- DISABLE(?Change) ! Disable Change Button
- DISABLE(?Delete) ! Disable Delete Button
- END ! End If
- !
- OF TCACTION:ExitBrowse !Exit Browse Action
- BREAK !
- END !End Process Browse Actions
- END !End Process File Browse Loop
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! EntrySearch:BRWQ2 Routine !
- ! !
- ! This routine processes a Entry search for ?List2 !
- !--------------------------------------------------------------------------------------------------!
- EntrySearch:BRWQ2 ROUTINE
-
- CASE SQ7:SortOrder !Setup Search for Current Sort Order
- OF 1 !For Current Sort Order
- ING:Ingredient = Search2 ! Fill Search Key
- OF 2 !For Current Sort Order
- ING:Measure = Search2 ! Fill Search Key
- ELSE !Otherwise if not using a entry locator
- EXIT ! Exit Routine
- END !End Case
-
- Search2 = '' !Clear Search Input Field
- DISPLAY(?Search2) !
- TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh) !Tell Browse to Redisplay
- TC_PROP:BRW(?List2,TCPROP:SetToKey,True) !Redisplay after searching by key
- SELECT(?List2) !Reselect Main List Box
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! StepSearch:BRWQ2 Routine !
- ! !
- ! This routine processes a step search for ?List2 !
- !--------------------------------------------------------------------------------------------------!
- StepSearch:BRWQ2 ROUTINE
-
- IF INRANGE(KEYCODE(),KeyPad0,KeyPad9) !If Key is a numeric keypad key
- SETKEYCODE(KEYCODE()-48) ! Convert to regular numeric key
- END !End If
- IF (INRANGE(KEYCODE(),Key0,ZKey) OR | !If Key is a lower case 0-Z Key
- INRANGE(KEYCODE(),Shift0,ShiftZ)) ! or it's a upper case 0-Z Key
- CASE SQ7:SortOrder ! Setup Locator for Current Sort Order
- OF 1 ! For Sort Orders Not Using Incremental Search
- ING:Ingredient = CHR(KEYCODE()) ! Move character into locator
- OF 2 ! For Sort Orders Not Using Incremental Search
- ING:Measure = CHR(KEYCODE()) ! Move character into locator
- END ! End Case
- TC_PROP:BRW(?List2,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List2,TCPROP:SetToKey,True) ! Redisplay after searching by key
- END !End If
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! LoadSortOrders:BRWQ2 Routine !
- ! !
- ! This routine loads the available sort options into the CWTabOrderQ:BRWQ2 !
- !--------------------------------------------------------------------------------------------------!
- LoadSortOrders:BRWQ2 ROUTINE
-
- FREE(CWTabOrderQ:BRWQ2) !Make sure queue is empty
-
- SQ7:SearchPicture = '@S15' !Set Picture for Search Field
- SQ7:OrderName = 'By Ingredient' !Set Name of Sort Order
- SQ7:OrderFormat = FORMAT:BRWQ2:Default !Set Format String for Sort Order
- ADD(CWTabOrderQ:BRWQ2) !Add the option
-
- SQ7:SearchPicture = '@S15' !Set Picture for Search Field
- SQ7:OrderName = 'By Measure' !Set Name of Sort Order
- SQ7:OrderFormat = FORMAT:BRWQ2:Order2 !Set Format String for Sort Order
- ADD(CWTabOrderQ:BRWQ2) !Add the option
-
- SQ7:SortOrder = 1 !Default to Sort Order #1
- GET(CWTabOrderQ:BRWQ2,SQ7:SortOrder) !Get Sort Order Entry from Queue
- SELECT(?ChangeOrder,SQ7:SortOrder) !Set Initial Sort Order for Drop Box
- ?Search2{PROP:Text} = SQ7:SearchPicture !Set Initial Picture for Search Field
- ?List2{PROP:Format} = SQ7:OrderFormat !Set Initial Format for List Box
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! BrowseList:BRWQ3 Routine !
- ! !
- ! This routine calls the browser to do a page-loaded display from a file. !
- !--------------------------------------------------------------------------------------------------!
- BrowseList:BRWQ3 ROUTINE
-
- IF NOT TC_PROP:BRW(?List3,TCPROP:Initialized) !If Browse Not Initialized
- IF NOT TC_InitBrowse(?List3,THREAD()) THEN EXIT. ! Initialize Browse Processing for List Box
- TC_PROP:BRW(?List3,TCPROP:InsertMode,1) ! Set Insert Mode to Top of List
- IF LocalRequest = SelectRecord ! If Browse Procedure Called as a Lookup
- TC_PROP:BRW(?List3,TCPROP:SetToPosition,1) ! Start Lookup on Current Record
- TC_PROP:BRW(?List3,TCPROP:SelectRecord,True) ! Set Double Click to Select Record
- END ! End If
- END !End If
- !
- LOOP !Process File Browse Loop
- TC_Browse(?List3 ,| ! Browse Handle
- INSTRUCTION ,| ! File Name
- INS:RECORD ,| ! Record Area
- INS:Key_Step ,| ! Key Order for Display
- BRWQ3 ,| ! Queue Name for List
- BRWQ3:Position ,| ! Record Position in Key Order
- INS:RecipeNo ,| ! Range Field
- RCP:RecipeNo ,| ! Match Range - Low Value
- RCP:RecipeNo ) ! Match Range - High Value
-
- CASE TC_PROP:BRW(?List3,TCPROP:Action) !Process Browse Actions
- OF TCACTION:FillQueue !Fill List Queue Action
- MQ11:Date = MEN:Date ! Prepare to Search for Marked Record
- GET(MarkQueue4,MQ11:Date) ! See if Record is Marked
- IF (NOT MarkAllFlag4 AND NOT ERROR()) OR | ! If Record is Marked
- (MarkAllFlag4 AND ERROR()) !
- MarkStatus4 = 'X' ! Show Record as Marked
- ELSE ! Otherwise
- MarkStatus4 = '' ! Show Record as Not Marked
- END ! End If
- BRWQ3:INS:Instruction = INS:Instruction ! Move Data to Queue
- BRWQ3:INS:Step = INS:Step ! Move Data to Queue
- !
- OF TCACTION:InsertRecord !Insert Record Action
- GET(INSTRUCTION,0) ! Clear Pending Record
- CLEAR(INS:RECORD) ! Clear Record Area
- BrowseAdvanced:Update:BRWQ3(?List3,TCACTION:InsertRecord) ! Call In-Line Update Procedure
- IF GlobalResponse = RequestCompleted ! If Update Completed
- TC_PROP:BRW(?List3,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List3,TCPROP:SetToPosition,2) ! Record at the current positon
- ELSE ! Otherwise
- DELETE(BRWQ3) ! Delete Cancelled Queue Record
- POST(EVENT:ScrollTop,?List3) ! Redisplay First Page of Records
- END ! End If
- !
- OF TCACTION:ChangeRecord !Change Record Action
- BrowseAdvanced:Update:BRWQ3(?List3,TCACTION:ChangeRecord) ! Call In-Line Update Procedure
- TC_PROP:BRW(?List3,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List3,TCPROP:SetToPosition,2) ! Record at the current positon
- !
- OF TCACTION:DeleteRecord !Delete Record Action
- BrowseAdvanced:Update:BRWQ3(?List3,TCACTION:DeleteRecord) ! Call In-Line Update Procedure
- TC_PROP:BRW(?List3,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List3,TCPROP:SetToItem,True) ! Record at the current positon
- !
- OF TCACTION:SelectRecord !Select Record Action
- LocalResponse = RequestCompleted ! Lookup was completed
- POST(Event:CloseWindow) ! Return Selected Record to Caller
- !
- OF TCACTION:DisplayFields !Display Fields Action
- IF RECORDS(BRWQ3) ! If Records Displayed
- ENABLE(?Change:3) ! Enable Change Button
- ENABLE(?Delete:3) ! Enable Delete Button
- ELSE ! Else
- DISABLE(?Change:3) ! Disable Change Button
- DISABLE(?Delete:3) ! Disable Delete Button
- END ! End If
- !
- OF TCACTION:ExitBrowse !Exit Browse Action
- BREAK !
- END !End Process Browse Actions
- END !End Process File Browse Loop
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! BrowseList:BRWQ4 Routine !
- ! !
- ! This routine calls the browser to do a page-loaded display from a file. !
- !--------------------------------------------------------------------------------------------------!
- BrowseList:BRWQ4 ROUTINE
-
- IF NOT TC_PROP:BRW(?List4,TCPROP:Initialized) !If Browse Not Initialized
- IF NOT TC_InitBrowse(?List4,THREAD()) THEN EXIT. ! Initialize Browse Processing for List Box
- IF LocalRequest = SelectRecord ! If Browse Procedure Called as a Lookup
- TC_PROP:BRW(?List4,TCPROP:SetToPosition,1) ! Start Lookup on Current Record
- TC_PROP:BRW(?List4,TCPROP:SelectRecord,True) ! Set Double Click to Select Record
- END ! End If
- END !End If
- !
- IF InLineActive !If InLine Mode is Active
- TC_PROP:BRW(?List4,TCPROP:InsertMode,1) ! Set Insert Mode to Top of List
- ELSE !Otherwise
- TC_PROP:BRW(?List4,TCPROP:InsertMode,0) ! Using Form - Turn off Insert Mode
- END !End If
- !
- LOOP !Process File Browse Loop
- TC_PROP:BRW(?List4,TCPROP:RevOrder,RevOrder:BRWQ4) ! Set Reverse Ordering Flag
- TC_Browse(?List4 ,| ! Browse Handle
- MENU ,| ! File Name
- MEN:RECORD ,| ! Record Area
- MEN:Key_Date ,| ! Key Order for Display
- BRWQ4 ,| ! Queue Name for List
- BRWQ4:Position ) ! Record Position in Key Order
-
- CASE TC_PROP:BRW(?List4,TCPROP:Action) !Process Browse Actions
- OF TCACTION:FillQueue !Fill List Queue Action
- MQ11:Date = MEN:Date ! Prepare to Search for Marked Record
- GET(MarkQueue4,MQ11:Date) ! See if Record is Marked
- IF (NOT MarkAllFlag4 AND NOT ERROR()) OR | ! If Record is Marked
- (MarkAllFlag4 AND ERROR()) !
- MarkStatus4 = 'X' ! Show Record as Marked
- ELSE ! Otherwise
- MarkStatus4 = '' ! Show Record as Not Marked
- END ! End If
- CLEAR(RCPALIAS:RECORD)
- RCPALIAS:RecipeNo = MEN:MainRcpNo
- GET(RecipeAlias,RCPALIAS:Key_RecipeNo)
- MOD:MainRcpDsp = RCPALIAS:Code
- CLEAR(RCPALIAS:RECORD)
- RCPALIAS:RecipeNo = MEN:SideRcpNo
- GET(RecipeAlias,RCPALIAS:Key_RecipeNo)
- MOD:SideRcpDsp = RCPALIAS:Code
- CLEAR(RCPALIAS:RECORD)
- RCPALIAS:RecipeNo = MEN:DessertRcpNo
- GET(RecipeAlias,RCPALIAS:Key_RecipeNo)
- MOD:DessertRcpDsp = RCPALIAS:Code
- BRWQ4:MEN:Date = MEN:Date ! Move Data to Queue
- BRWQ4:MOD:DessertRcpDsp = MOD:DessertRcpDsp ! Move Data to Queue
- BRWQ4:MOD:MainRcpDsp = MOD:MainRcpDsp ! Move Data to Queue
- BRWQ4:MOD:SideRcpDsp = MOD:SideRcpDsp ! Move Data to Queue
- BRWQ4:MarkStatus4 = MarkStatus4 ! Move Data to Queue
- !
- OF TCACTION:InsertRecord !Insert Record Action
- IF InLineActive
- MOD:MainRcpDsp = ''
- MOD:SideRcpDsp = ''
- MOD:DessertRcpDsp = ''
- END
- GET(MENU,0) ! Clear Pending Record
- CLEAR(MEN:RECORD) ! Clear Record Area
- IF InLineActive
- BrowseAdvanced:Update:BRWQ4(?List4,TCACTION:InsertRecord) ! Call In-Line Update Procedure
- IF GlobalResponse = RequestCompleted ! If Update Completed
- TC_PROP:BRW(?List4,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List4,TCPROP:SetToPosition,2) ! Record at the current positon
- ELSE ! Otherwise
- DELETE(BRWQ4) ! Delete Cancelled Queue Record
- POST(EVENT:ScrollTop,?List4) ! Redisplay First Page of Records
- END ! End If
- ELSE
- GlobalRequest = InsertRecord ! Tell Form To Insert Record
- UpdateMenu ! Insert Record
- IF GlobalResponse = RequestCompleted ! If Record Added
- TC_PROP:BRW(?List4,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List4,TCPROP:SetToPosition,1) ! Record at Current Key Positon
- END ! End If
- END
- !
- OF TCACTION:ChangeRecord !Change Record Action
- IF InLineActive
- MOD:MainRcpDsp = BRWQ4:MOD:MainRcpDsp
- MOD:SideRcpDsp = BRWQ4:MOD:SideRcpDsp
- MOD:DessertRcpDsp = BRWQ4:MOD:DessertRcpDsp
- END
- IF InLineActive
- BrowseAdvanced:Update:BRWQ4(?List4,TCACTION:ChangeRecord) ! Call In-Line Update Procedure
- TC_PROP:BRW(?List4,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List4,TCPROP:SetToPosition,2) ! Record at the current positon
- ELSE
- GlobalRequest = ChangeRecord ! Tell Form To Change Record
- UpdateMenu ! Change Record
- IF GlobalResponse = RequestCompleted ! If Record Added
- TC_PROP:BRW(?List4,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List4,TCPROP:SetToPosition,1) ! Record at the Current Key Positon
- END ! End If
- END
- !
- OF TCACTION:DeleteRecord !Delete Record Action
- IF InLineActive
- BrowseAdvanced:Update:BRWQ4(?List4,TCACTION:DeleteRecord) ! Call In-Line Update Procedure
- TC_PROP:BRW(?List4,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List4,TCPROP:SetToItem,True) ! Record at the current positon
- ELSE
- GlobalRequest = DeleteRecord ! Tell Form To Delete Record
- UpdateMenu ! Delete Record
- IF GlobalResponse = RequestCompleted ! If Record Deleted
- TC_PROP:BRW(?List4,TCPROP:Action,TCACTION:Refresh) ! Tell Browse to Redisplay
- TC_PROP:BRW(?List4,TCPROP:SetToItem,True) ! Record at the Current Item
- END ! End If
- END
- !
- OF TCACTION:SelectRecord !Select Record Action
- LocalResponse = RequestCompleted ! Lookup was completed
- POST(Event:CloseWindow) ! Return Selected Record to Caller
- !
- OF TCACTION:DisplayFields !Display Fields Action
- IF RECORDS(BRWQ4) ! If Records Displayed
- ENABLE(?Mark:1) ! Enable the Mark Button
- ENABLE(?Unmark:1) ! Enable the Unmark Button
- ENABLE(?MarkAll:1) ! Enable the Mark All Button
- ENABLE(?UnmarkAll:1) ! Enable the Unmark All Button
- ENABLE(?Change:2) ! Enable Change Button
- ENABLE(?Delete:2) ! Enable Delete Button
- ELSE ! Else
- DISABLE(?Mark:1) ! Disable the Mark Button
- DISABLE(?Unmark:1) ! Disable the Unmark Button
- DISABLE(?MarkAll:1) ! Disable the Mark All Button
- DISABLE(?UnmarkAll:1) ! Disable the Unmark All Button
- DISABLE(?Change:2) ! Disable Change Button
- DISABLE(?Delete:2) ! Disable Delete Button
- END ! End If
- !
- OF TCACTION:ExitBrowse !Exit Browse Action
- BREAK !
- END !End Process Browse Actions
- END !End Process File Browse Loop
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! EntrySearch:BRWQ4 Routine !
- ! !
- ! This routine processes a Entry search for ?List4 !
- !--------------------------------------------------------------------------------------------------!
- EntrySearch:BRWQ4 ROUTINE
-
- IF TC_PROP:BRW(?List4,TCPROP:RevOrder) !If Using Reverse Key Order
- MEN:Date = CLIP(Search4) & '<255>' ! Fill Search Key and Adjust for Key Order
- ELSE !Otherwise
- MEN:Date = Search4 ! Fill Search key
- END !End If
- Search4 = '' !Clear Search Input Field
- DISPLAY(?Search4) !
- TC_PROP:BRW(?List4,TCPROP:Action,TCACTION:Refresh) !Tell Browse to Redisplay
- TC_PROP:BRW(?List4,TCPROP:SetToKey,True) !Redisplay after searching by key
- SELECT(?List4) !Reselect Main List Box
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! ProcedureReturn Routine !
- ! !
- ! End of procedure cleanup and exit. !
- !--------------------------------------------------------------------------------------------------!
- ProcedureReturn ROUTINE
-
- INGREDIENT::Used -= 1
- IF INGREDIENT::Used = 0 THEN CLOSE(INGREDIENT).
- INSTRUCTION::Used -= 1
- IF INSTRUCTION::Used = 0 THEN CLOSE(INSTRUCTION).
- MENU::Used -= 1
- IF MENU::Used = 0 THEN CLOSE(MENU).
- RECIPE::Used -= 1
- IF RECIPE::Used = 0 THEN CLOSE(RECIPE).
- RecipeAlias::Used -= 1
- IF RecipeAlias::Used = 0 THEN CLOSE(RecipeAlias).
-
- IF WindowOpened
- INISaveWindow('BrowseAdvanced','PTDEMO.INI')
- CLOSE(Screen)
- END
-
- FREE(BRWQ) !Release Memory use by Browse Queue
- FREE(CWTabOrderQ:BRWQ2) !Release Memory use by SortOrder Queue
- FREE(BRWQ2) !Release Memory use by Browse Queue
- FREE(BRWQ3) !Release Memory use by Browse Queue
- FREE(BRWQ4) !Release Memory use by Browse Queue
- FREE(MarkQueue4) !Release Memory use by Mark Records Queue
-
- GlobalResponse = LocalResponse
- RETURN
-
-
- !==================================================================================================!
- ! !
- ! BrowseAdvanced:Update:BRWQ2 Procedure !
- ! ------------------------------------ !
- ! FILE NAME : INGREDIENT !
- ! LIST CONTROL: ?List2 !
- ! FROM QUEUE : BRWQ2 !
- ! !
- !==================================================================================================!
- BrowseAdvanced:Update:BRWQ2 PROCEDURE(ListControl,UpdateAction,SortOrder,AbortButton,SaveButton)
-
- FieldOrder1 EQUATE('1,2,3') !Field Order for Sort Order 1
- FieldOrder2 EQUATE('2,3,1') !Field Order for Sort Order 2
-
- ?ING:Ingredient EQUATE(101) !Set Field Number for ING:Ingredient
- ?ING:Measure EQUATE(102) !Set Field Number for ING:Measure
- ?ING:Quantity EQUATE(103) !Set Field Number for ING:Quantity
-
- InLineFieldSetup GROUP
- LONG(CREATE:Entry) !Control Type for ?ING:Ingredient
- LONG(CREATE:DropList) !Control Type for ?ING:Measure
- LONG(CREATE:Spin) !Control Type for ?ING:Quantity
- END
- InLineFields LONG,DIM(3),OVER(InLineFieldSetup)
-
- LocalResponse LONG,AUTO
- SAVE:ING:RECORD STRING(SIZE(ING:RECORD))
-
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! Code Section !
- !--------------------------------------------------------------------------------------------------!
- CODE
-
- LocalResponse = RequestCancelled !Default to Request Cancelled
- CASE UpdateAction !Process Setup for Update Actions
- OF TCACTION:InsertRecord !On Insert New Record
- ING:RecipeNo = RCP:RecipeNo
- SAVE:ING:RECORD = ING:RECORD ! Save the Current Record
- ING:Quantity = 1 ! Prime Field
- !
- OF TCACTION:ChangeRecord !On Change Record
- SAVE:ING:RECORD = ING:RECORD ! Save the Current Record
- !
- OF TCACTION:DeleteRecord !On Delete Record
- DO DeleteRecord ! Delete the Record
- GlobalResponse = LocalResponse ! Set Global Response
- RETURN ! Exit Update Procedure
- END !End Case
- !
- ListControl{PROP:NoBar} = 1 !Turn Off Point Bar
- !
- LOOP !Process InLine Actions
- IF UpdateAction = TCACTION:ChangeRecord !If Editing an Existing Record
- TC:INL:UpdateMode = 1 ! Use Column Edit Option
- END !End If
- TC:INL:FirstField = ?ING:Ingredient !Set First Field Number
- EXECUTE SortOrder !Edit by Sort Order
- TC_InLine(ListControl,InLineFields[],FieldOrder1) !Call InLine Editing
- TC_InLine(ListControl,InLineFields[],FieldOrder2) !Call InLine Editing
- END !End Execute
- !
- CASE TC:INL:Action !Process InLine Actions
- OF TCACTION:SetFields !Set Field Properties Action
- !--------- ?ING:Ingredient ---------
- ?ING:Ingredient{PROP:Use} = ING:Ingredient
- ?ING:Ingredient{PROP:Msg} = 'Enter an Ingredient'
-
- !--------- ?ING:Measure ---------
- ?ING:Measure{PROP:Use} = ING:Measure
- ?ING:Measure{PROP:Msg} = 'Select a Measure'
- ?ING:Measure{PROP:Drop} = 7
- ?ING:Measure{PROP:From} = 'cup|gallon|lb|ounce|pint|Tbl|tsp'
- ?ING:Measure{PROP:Format} = '32L@S8@'
-
- !--------- ?ING:Quantity ---------
- ?ING:Quantity{PROP:Use} = ING:Quantity
- ?ING:Quantity{PROP:Msg} = 'Select a Quantity'
- ?ING:Quantity{PROP:RangeHigh} = 99
- ?ING:Quantity{PROP:RangeLow} = 1
- ?ING:Quantity{PROP:Step} = 1
-
- OF TCACTION:SetHotKeys !Set Hot Keys Action
- TC:INL:AbortKey = EscKey ! Set Cancel Key
- TC:INL:SaveKey = CtrlEnter ! Set Save Key
- TC:INL:EditNextKey1 = DownKey ! Set Next Rec Key for Column Edit
- TC:INL:EditPrevKey1 = UpKey ! Set Previous Rec Key for Column Edit
-
- OF TCACTION:FieldEdits !Process Field Edits Action
- CASE TC:INL:Field
- OF ?ING:Measure
- IF NOT ING:Measure
- BEEP
- TC:INL:AbortUpdate = ?ING:Measure
- END
- END
-
- OF TCACTION:UpdateRecord !Update Record Action
- IF SAVE:ING:RECORD = ING:RECORD !If the Record was Not Changed
- LocalResponse = RequestCompleted ! Set Local Response to Completed
- CYCLE ! Nothing to Save - Exit In-Line
- END !End If
- LOOP !Attempt to Update Until Done or Canceled
- Error# = DUPLICATE(INGREDIENT) ! Test For Duplicate Key
- IF Error# ! If Duplicate Key Error
- Button# = MESSAGE('Updating this record creates a duplicate entry!', |
- 'Duplicate Key Error',ICON:Exclamation,Button:OK,Button:OK,0)
- ELSE ! Otherwise
- SETCURSOR(Cursor:Wait) ! Show Hour-Glass Cursor
- IF UpdateAction = TCACTION:InsertRecord ! If Inserting a New Record
- ADD(INGREDIENT) ! Add the Record
- Error# = ERRORCODE() ! Set Error Flag
- ELSE ! Otherwise on Updating a Record
- Error# = RIUpdate:INGREDIENT() ! Attempt Update
- END ! End If
- END ! End If
- IF Error# ! If Error Updating
- SETCURSOR() ! Reset to Normal Cursor
- Button# = StandardWarning(Warn:UpdateError) ! Ask If User Wants to Try Saving Again
- DISPLAY ! Refresh Screen
- CASE Button# ! Process User Response
- OF Button:Yes ! On YES Button
- CYCLE ! Retry Update Operation
- OF Button:No ! On NO Button
- BREAK ! Exit without Updating Record
- OF Button:Cancel ! On Cancel Button
- TC:INL:AbortUpdate = True ! Tell Inline to Cancel Update Request
- BREAK ! Go back to editing record
- END ! End Case
- END ! End If
- SETCURSOR() ! Reset to Normal Cursor
- LocalResponse = RequestCompleted ! Set Local Response to Completed
- BREAK ! Exit Update Loop
- END !End Loop
- !
- OF TCACTION:AbortUpdate !Abort Update Action
- IF TC:INL:ResizeWindow THEN CYCLE. !Always abort changes on resize
- IF SAVE:ING:RECORD <> ING:RECORD !If the Record was Changed
- Button# = StandardWarning(Warn:SaveOnCancel) ! Display Save on Cancel Message
- DISPLAY ! Refresh Screen
- CASE Button# ! Process User Response
- OF Button:Yes ! On YES Button
- TC:INL:AbortUpdate = False ! Cancel the Request to Abort
- TC:INL:SelectField = ListControl ! Select List to Exit & Save Changes
- OF Button:No ! On NO Button
- TC:INL:AbortUpdate = True ! Go Ahead and Abandon the Changes
- OF BUTTON:Cancel ! On Cancel Button
- TC:INL:AbortUpdate = False ! Cancel the Request and Continue
- END ! End Case
- END !End If
- IF UpdateAction = TCACTION:InsertRecord !If Adding a New Record
- IF TC:INL:AbortUpdate = True ! If Record Add was Aborted
- DELETE(INGREDIENT) ! Delete the New Record from the File
- END ! End If
- END !End If
- !
- OF TCACTION:ExitInLine !Exit InLine Action
- BREAK !
- END !End Case on Actions
- END !End Loop
- !
- GlobalResponse = LocalResponse !Set Global Response
- RETURN !Exit In-Line Update Procedure
-
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! Delete Record Routine !
- ! !
- ! This routine Deletes the Record. !
- !--------------------------------------------------------------------------------------------------!
- DeleteRecord ROUTINE
-
- LocalResponse = RequestCancelled !Default to Request to Delete Cancelled
- !
- Confirm# = StandardWarning(Warn:StandardDelete) !Get Confirmation from User
- DISPLAY !Refresh Screen
- IF Confirm# <> Button:OK THEN EXIT. !If User Did Not Confirm Delete then Exit
- !
- LOOP !Attempt to Delete Until Done or Canceled
- SETCURSOR(Cursor:Wait) ! Show Hour-Glass Cursor
- IF RIDelete:INGREDIENT() ! If Error Deleting
- SETCURSOR() ! Reset to Normal Cursor
- CASE StandardWarning(Warn:DeleteError) ! Ask If User Wants to Try Deleting Again
- OF Button:Yes ! On YES Button
- CYCLE ! Retry Delete Operation
- OF Button:No ! On NO Button
- OROF Button:Cancel ! Or On Cancel Button
- BREAK ! Exit without Deleting Record
- END ! End Case
- END ! End If
- SETCURSOR() ! Reset to Normal Cursor
- LocalResponse = RequestCompleted ! Set Request Completed
- BREAK ! Exit Delete Loop
- END !End Loop
-
-
-
-
- !==================================================================================================!
- ! !
- ! BrowseAdvanced:Update:BRWQ3 Procedure !
- ! ------------------------------------ !
- ! FILE NAME : INSTRUCTION !
- ! LIST CONTROL: ?List3 !
- ! FROM QUEUE : BRWQ3 !
- ! !
- !==================================================================================================!
- BrowseAdvanced:Update:BRWQ3 PROCEDURE(ListControl,UpdateAction,AbortButton,SaveButton)
-
- FieldOrder EQUATE('1,2') !Field Order for Sort Order
-
- ?INS:Step EQUATE(104) !Set Field Number for INS:Step
- ?INS:Instruction EQUATE(105) !Set Field Number for INS:Instruction
-
- InLineFieldSetup GROUP
- LONG(CREATE:Spin) !Control Type for ?INS:Step
- LONG(CREATE:Entry) !Control Type for ?INS:Instruction
- END
- InLineFields LONG,DIM(2),OVER(InLineFieldSetup)
-
- LocalResponse LONG,AUTO
- SAVE:INS:RECORD STRING(SIZE(INS:RECORD))
-
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! Code Section !
- !--------------------------------------------------------------------------------------------------!
- CODE
-
- LocalResponse = RequestCancelled !Default to Request Cancelled
- CASE UpdateAction !Process Setup for Update Actions
- OF TCACTION:InsertRecord !On Insert New Record
- INS:RecipeNo = RCP:RecipeNo
- SAVE:INS:RECORD = INS:RECORD ! Save the Current Record
- INS:Step = 1 ! Prime Field
- !
- OF TCACTION:ChangeRecord !On Change Record
- SAVE:INS:RECORD = INS:RECORD ! Save the Current Record
- !
- OF TCACTION:DeleteRecord !On Delete Record
- DO DeleteRecord ! Delete the Record
- GlobalResponse = LocalResponse ! Set Global Response
- RETURN ! Exit Update Procedure
- END !End Case
- !
- ListControl{PROP:NoBar} = 1 !Turn Off Point Bar
- !
- LOOP !Process InLine Actions
- TC:INL:FirstField = ?INS:Step !Set First Field Number
- TC_InLine(ListControl,InLineFields[],FieldOrder) !Call InLine Editing
- !
- CASE TC:INL:Action !Process InLine Actions
- OF TCACTION:SetFields !Set Field Properties Action
- !--------- ?INS:Instruction ---------
- ?INS:Instruction{PROP:Use} = INS:Instruction
- ?INS:Instruction{PROP:Msg} = 'Enter Instructions for this step'
-
- !--------- ?INS:Step ---------
- ?INS:Step{PROP:Use} = INS:Step
- ?INS:Step{PROP:Msg} = 'Select the Step Number'
- ?INS:Step{PROP:RangeHigh} = 99
- ?INS:Step{PROP:RangeLow} = 1
- ?INS:Step{PROP:Step} = 1
-
- OF TCACTION:SetHotKeys !Set Hot Keys Action
- TC:INL:AbortKey = EscKey ! Set Cancel Key
- TC:INL:SaveKey = CtrlEnter ! Set Save Key
-
- OF TCACTION:UpdateRecord !Update Record Action
- IF SAVE:INS:RECORD = INS:RECORD !If the Record was Not Changed
- LocalResponse = RequestCompleted ! Set Local Response to Completed
- CYCLE ! Nothing to Save - Exit In-Line
- END !End If
- LOOP !Attempt to Update Until Done or Canceled
- Error# = DUPLICATE(INSTRUCTION) ! Test For Duplicate Key
- IF Error# ! If Duplicate Key Error
- Button# = MESSAGE('Updating this record creates a duplicate entry!', |
- 'Duplicate Key Error',ICON:Exclamation,Button:OK,Button:OK,0)
- ELSE ! Otherwise
- SETCURSOR(Cursor:Wait) ! Show Hour-Glass Cursor
- IF UpdateAction = TCACTION:InsertRecord ! If Inserting a New Record
- ADD(INSTRUCTION) ! Add the Record
- Error# = ERRORCODE() ! Set Error Flag
- ELSE ! Otherwise on Updating a Record
- Error# = RIUpdate:INSTRUCTION() ! Attempt Update
- END ! End If
- END ! End If
- IF Error# ! If Error Updating
- SETCURSOR() ! Reset to Normal Cursor
- Button# = StandardWarning(Warn:UpdateError) ! Ask If User Wants to Try Saving Again
- DISPLAY ! Refresh Screen
- CASE Button# ! Process User Response
- OF Button:Yes ! On YES Button
- CYCLE ! Retry Update Operation
- OF Button:No ! On NO Button
- BREAK ! Exit without Updating Record
- OF Button:Cancel ! On Cancel Button
- TC:INL:AbortUpdate = True ! Tell Inline to Cancel Update Request
- BREAK ! Go back to editing record
- END ! End Case
- END ! End If
- SETCURSOR() ! Reset to Normal Cursor
- LocalResponse = RequestCompleted ! Set Local Response to Completed
- BREAK ! Exit Update Loop
- END !End Loop
- !
- OF TCACTION:AbortUpdate !Abort Update Action
- IF TC:INL:ResizeWindow THEN CYCLE. !Always abort changes on resize
- IF SAVE:INS:RECORD <> INS:RECORD !If the Record was Changed
- Button# = StandardWarning(Warn:SaveOnCancel) ! Display Save on Cancel Message
- DISPLAY ! Refresh Screen
- CASE Button# ! Process User Response
- OF Button:Yes ! On YES Button
- TC:INL:AbortUpdate = False ! Cancel the Request to Abort
- TC:INL:SelectField = ListControl ! Select List to Exit & Save Changes
- OF Button:No ! On NO Button
- TC:INL:AbortUpdate = True ! Go Ahead and Abandon the Changes
- OF BUTTON:Cancel ! On Cancel Button
- TC:INL:AbortUpdate = False ! Cancel the Request and Continue
- END ! End Case
- END !End If
- IF UpdateAction = TCACTION:InsertRecord !If Adding a New Record
- IF TC:INL:AbortUpdate = True ! If Record Add was Aborted
- DELETE(INSTRUCTION) ! Delete the New Record from the File
- END ! End If
- END !End If
- !
- OF TCACTION:ExitInLine !Exit InLine Action
- BREAK !
- END !End Case on Actions
- END !End Loop
- !
- GlobalResponse = LocalResponse !Set Global Response
- RETURN !Exit In-Line Update Procedure
-
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! Delete Record Routine !
- ! !
- ! This routine Deletes the Record. !
- !--------------------------------------------------------------------------------------------------!
- DeleteRecord ROUTINE
-
- LocalResponse = RequestCancelled !Default to Request to Delete Cancelled
- !
- Confirm# = StandardWarning(Warn:StandardDelete) !Get Confirmation from User
- DISPLAY !Refresh Screen
- IF Confirm# <> Button:OK THEN EXIT. !If User Did Not Confirm Delete then Exit
- !
- LOOP !Attempt to Delete Until Done or Canceled
- SETCURSOR(Cursor:Wait) ! Show Hour-Glass Cursor
- IF RIDelete:INSTRUCTION() ! If Error Deleting
- SETCURSOR() ! Reset to Normal Cursor
- CASE StandardWarning(Warn:DeleteError) ! Ask If User Wants to Try Deleting Again
- OF Button:Yes ! On YES Button
- CYCLE ! Retry Delete Operation
- OF Button:No ! On NO Button
- OROF Button:Cancel ! Or On Cancel Button
- BREAK ! Exit without Deleting Record
- END ! End Case
- END ! End If
- SETCURSOR() ! Reset to Normal Cursor
- LocalResponse = RequestCompleted ! Set Request Completed
- BREAK ! Exit Delete Loop
- END !End Loop
-
-
-
-
- !==================================================================================================!
- ! !
- ! BrowseAdvanced:Update:BRWQ4 Procedure !
- ! ------------------------------------ !
- ! FILE NAME : MENU !
- ! LIST CONTROL: ?List4 !
- ! FROM QUEUE : BRWQ4 !
- ! !
- !==================================================================================================!
- BrowseAdvanced:Update:BRWQ4 PROCEDURE(ListControl,UpdateAction,AbortButton,SaveButton)
-
- FieldOrder EQUATE('0,1,2,3,4') !Field Order for Sort Order
-
- ?MEN:Date EQUATE(106) !Set Field Number for MEN:Date
- ?MOD:MainRcpDsp EQUATE(107) !Set Field Number for MOD:MainRcpDsp
- ?MOD:SideRcpDsp EQUATE(108) !Set Field Number for MOD:SideRcpDsp
- ?MOD:DessertRcpDsp EQUATE(109) !Set Field Number for MOD:DessertRcpDsp
-
- InLineFieldSetup GROUP
- LONG(CREATE:Entry) !Control Type for ?MEN:Date
- LONG(CREATE:Entry) !Control Type for ?MOD:MainRcpDsp
- LONG(CREATE:Entry) !Control Type for ?MOD:SideRcpDsp
- LONG(CREATE:Entry) !Control Type for ?MOD:DessertRcpDsp
- END
- InLineFields LONG,DIM(4),OVER(InLineFieldSetup)
-
- LocalResponse LONG,AUTO
- SAVE:MEN:RECORD STRING(SIZE(MEN:RECORD))
-
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! Code Section !
- !--------------------------------------------------------------------------------------------------!
- CODE
-
- LocalResponse = RequestCancelled !Default to Request Cancelled
- CASE UpdateAction !Process Setup for Update Actions
- OF TCACTION:InsertRecord !On Insert New Record
- SAVE:MEN:RECORD = MEN:RECORD ! Save the Current Record
- !
- OF TCACTION:ChangeRecord !On Change Record
- SAVE:MEN:RECORD = MEN:RECORD ! Save the Current Record
- !
- OF TCACTION:DeleteRecord !On Delete Record
- DO DeleteRecord ! Delete the Record
- GlobalResponse = LocalResponse ! Set Global Response
- RETURN ! Exit Update Procedure
- END !End Case
- !
- ListControl{PROP:NoBar} = 1 !Turn Off Point Bar
- !
- LOOP !Process InLine Actions
- TC:INL:FirstField = ?MEN:Date !Set First Field Number
- TC_InLine(ListControl,InLineFields[],FieldOrder) !Call InLine Editing
- !
- CASE TC:INL:Action !Process InLine Actions
- OF TCACTION:SetFields !Set Field Properties Action
- !--------- ?MEN:Date ---------
- ?MEN:Date{PROP:Use} = MEN:Date
- ?MEN:Date{PROP:Req} = 1
-
- !--------- ?MOD:DessertRcpDsp ---------
- ?MOD:DessertRcpDsp{PROP:Use} = MOD:DessertRcpDsp
-
- !--------- ?MOD:MainRcpDsp ---------
- ?MOD:MainRcpDsp{PROP:Use} = MOD:MainRcpDsp
-
- !--------- ?MOD:SideRcpDsp ---------
- ?MOD:SideRcpDsp{PROP:Use} = MOD:SideRcpDsp
-
- OF TCACTION:SetHotKeys !Set Hot Keys Action
- TC:INL:AbortKey = EscKey ! Set Cancel Key
- TC:INL:SaveKey = CtrlEnter ! Set Save Key
-
- OF TCACTION:FieldEdits !Process Field Edits Action
- CASE TC:INL:Field
- OF ?MOD:MainRcpDsp ! OF the Main Dish field
- CLEAR(RCPALIAS:Record) ! clear the Recipe file record
- RCPALIAS:Code = MOD:MainRcpDsp ! set the Code to the Main Dish entered
- GET(RecipeAlias,RCPALIAS:Key_Code) ! see if the code is a valid recipe code
- IF ERROR() OR RCPALIAS:Type <> 1 ! IF it is not valid or not a Main Dish recipe
- TypeFilter = '1' ! set the recipe filter type to Main Dish
- GlobalRequest = SelectRecord ! set the action for a lookup
- RcpPosition" = POSITION(RECIPE) ! Save the current Recipe Postion for DropComboBrowse
- BrowseBeginning ! call the beginning browse as a lookup
- RCPALIAS:Code = RCP:Code ! Set the Alias file to the selected Recipe
- GET(RecipeAlias,RCPALIAS:Key_Code) ! Get the Alias record
- REGET(RECIPE,RcpPosition") ! Reget the Recipe record for the DropComboBrowse
- LocalResponse = GlobalResponse ! save the lookup action for evaluation
- GlobalResponse = RequestCancelled ! clear the action
- IF LocalResponse = RequestCancelled ! IF no recipe was selected
- CLEAR(RCPALIAS:Record) ! Clear the Recipe file record and
- TC:INL:AbortUpdate = ?MOD:MainRcpDsp ! reselect the Main Dish field again
- END ! END if no recipe selected processing
- END ! END if valid code not selected processing
- MEN:MainRcpNo = RCPALIAS:RecipeNo ! save the selected Main Recipe to file
- MOD:MainRcpDsp = RCPALIAS:Code ! set the Main Recipe display field code
- DISPLAY(?MOD:MainRcpDsp) ! redisplay the Main Recipe display field
- OF ?MOD:SideRcpDsp ! OF the Side Dish field
- CLEAR(RCPALIAS:Record) ! clear the Recipe file record
- RCPALIAS:Code = MOD:SideRcpDsp ! set the Code to the Side Dish entered
- GET(RecipeAlias,RCPALIAS:Key_Code) ! see if the code is a valid recipe code
- IF ERROR() OR RCPALIAS:Type <> 2 ! IF it is not valid or not a Side Dish recipe
- TypeFilter = '2' ! set the recipe filter type to Side Dish
- GlobalRequest = SelectRecord ! set the action for a lookup
- RcpPosition" = POSITION(RECIPE) ! Save the current Recipe Postion for DropComboBrowse!
- BrowseBeginning ! call the beginning browse as a lookup
- RCPALIAS:Code = RCP:Code ! Set the Alias file to the selected Recipe
- GET(RecipeAlias,RCPALIAS:Key_Code) ! Get the Alias record
- REGET(RECIPE,RcpPosition") ! Reget the Recipe record for the DropComboBrowse
- LocalResponse = GlobalResponse ! save the lookup action for evaluation
- GlobalResponse = RequestCancelled ! clear the action
- IF LocalResponse = RequestCancelled ! IF no recipe was selected
- CLEAR(RCPALIAS:Record) ! Clear the Recipe file record and
- TC:INL:AbortUpdate = ?MOD:SideRcpDsp ! reselect the Side Dish field again
- END ! END if no recipe selected processing
- END ! END if valid code not selected processing
- MEN:SideRcpNo = RCPALIAS:RecipeNo ! save the selected Side Recipe to file
- MOD:SideRcpDsp = RCPALIAS:Code ! set the Side Recipe display field code
- DISPLAY(?MOD:SideRcpDsp) ! redisplay the Side Recipe display field
- OF ?MOD:DessertRcpDsp ! OF the Dessert Dish field
- CLEAR(RCPALIAS:Record) ! clear the Recipe file record
- RCPALIAS:Code = MOD:DessertRcpDsp ! set the Code to the Dessert Dish entered
- GET(RecipeAlias,RCPALIAS:Key_Code) ! see if the code is a valid recipe code
- IF ERROR() OR RCPALIAS:Type <> 3 ! IF it is not valid or not a Dessert Dish recipe
- TypeFilter = '3' ! set the recipe filter type to Dessert Dish
- GlobalRequest = SelectRecord ! set the action for a lookup
- RcpPosition" = POSITION(RECIPE) ! Save the current Recipe Postion for DropComboBrowse!
- BrowseBeginning ! call the beginning browse as a lookup
- RCPALIAS:Code = RCP:Code ! Set the Alias file to the selected Recipe
- GET(RecipeAlias,RCPALIAS:Key_Code) ! Get the Alias record
- REGET(RECIPE,RcpPosition") ! Reget the Recipe record for the DropComboBrowse
- LocalResponse = GlobalResponse ! save the lookup action for evaluation
- GlobalResponse = RequestCancelled ! clear the action
- IF LocalResponse = RequestCancelled ! IF no recipe was selected
- CLEAR(RCPALIAS:Record) ! Clear the Recipe file record and
- TC:INL:AbortUpdate = ?MOD:DessertRcpDsp ! reselect the Dessert Dish field again
- END ! END if no recipe selected processing
- END ! END if valid code not selected processing
- MEN:DessertRcpNo = RCPALIAS:RecipeNo ! save the selected Dessert Recipe to file
- MOD:DessertRcpDsp = RCPALIAS:Code ! set the Dessert Recipe display field code
- DISPLAY(?MOD:DessertRcpDsp) ! redisplay the Dessert Recipe display field
- END
-
- OF TCACTION:UpdateRecord !Update Record Action
- IF SAVE:MEN:RECORD = MEN:RECORD !If the Record was Not Changed
- LocalResponse = RequestCompleted ! Set Local Response to Completed
- CYCLE ! Nothing to Save - Exit In-Line
- END !End If
- LOOP !Attempt to Update Until Done or Canceled
- Error# = DUPLICATE(MENU) ! Test For Duplicate Key
- IF Error# ! If Duplicate Key Error
- Button# = MESSAGE('Updating this record creates a duplicate entry!', |
- 'Duplicate Key Error',ICON:Exclamation,Button:OK,Button:OK,0)
- ELSE ! Otherwise
- SETCURSOR(Cursor:Wait) ! Show Hour-Glass Cursor
- IF UpdateAction = TCACTION:InsertRecord ! If Inserting a New Record
- ADD(MENU) ! Add the Record
- Error# = ERRORCODE() ! Set Error Flag
- ELSE ! Otherwise on Updating a Record
- Error# = RIUpdate:MENU() ! Attempt Update
- END ! End If
- END ! End If
- IF Error# ! If Error Updating
- SETCURSOR() ! Reset to Normal Cursor
- Button# = StandardWarning(Warn:UpdateError) ! Ask If User Wants to Try Saving Again
- DISPLAY ! Refresh Screen
- CASE Button# ! Process User Response
- OF Button:Yes ! On YES Button
- CYCLE ! Retry Update Operation
- OF Button:No ! On NO Button
- BREAK ! Exit without Updating Record
- OF Button:Cancel ! On Cancel Button
- TC:INL:AbortUpdate = True ! Tell Inline to Cancel Update Request
- BREAK ! Go back to editing record
- END ! End Case
- END ! End If
- SETCURSOR() ! Reset to Normal Cursor
- LocalResponse = RequestCompleted ! Set Local Response to Completed
- BREAK ! Exit Update Loop
- END !End Loop
- !
- OF TCACTION:AbortUpdate !Abort Update Action
- IF TC:INL:ResizeWindow THEN CYCLE. !Always abort changes on resize
- IF SAVE:MEN:RECORD <> MEN:RECORD !If the Record was Changed
- Button# = StandardWarning(Warn:SaveOnCancel) ! Display Save on Cancel Message
- DISPLAY ! Refresh Screen
- CASE Button# ! Process User Response
- OF Button:Yes ! On YES Button
- TC:INL:AbortUpdate = False ! Cancel the Request to Abort
- TC:INL:SelectField = ListControl ! Select List to Exit & Save Changes
- OF Button:No ! On NO Button
- TC:INL:AbortUpdate = True ! Go Ahead and Abandon the Changes
- OF BUTTON:Cancel ! On Cancel Button
- TC:INL:AbortUpdate = False ! Cancel the Request and Continue
- END ! End Case
- END !End If
- IF UpdateAction = TCACTION:InsertRecord !If Adding a New Record
- IF TC:INL:AbortUpdate = True ! If Record Add was Aborted
- DELETE(MENU) ! Delete the New Record from the File
- END ! End If
- END !End If
- !
- OF TCACTION:ExitInLine !Exit InLine Action
- BREAK !
- END !End Case on Actions
- END !End Loop
- !
- GlobalResponse = LocalResponse !Set Global Response
- RETURN !Exit In-Line Update Procedure
-
-
-
-
- !--------------------------------------------------------------------------------------------------!
- ! Delete Record Routine !
- ! !
- ! This routine Deletes the Record. !
- !--------------------------------------------------------------------------------------------------!
- DeleteRecord ROUTINE
-
- LocalResponse = RequestCancelled !Default to Request to Delete Cancelled
- !
- Confirm# = StandardWarning(Warn:StandardDelete) !Get Confirmation from User
- DISPLAY !Refresh Screen
- IF Confirm# <> Button:OK THEN EXIT. !If User Did Not Confirm Delete then Exit
- !
- LOOP !Attempt to Delete Until Done or Canceled
- SETCURSOR(Cursor:Wait) ! Show Hour-Glass Cursor
- IF RIDelete:MENU() ! If Error Deleting
- SETCURSOR() ! Reset to Normal Cursor
- CASE StandardWarning(Warn:DeleteError) ! Ask If User Wants to Try Deleting Again
- OF Button:Yes ! On YES Button
- CYCLE ! Retry Delete Operation
- OF Button:No ! On NO Button
- OROF Button:Cancel ! Or On Cancel Button
- BREAK ! Exit without Deleting Record
- END ! End Case
- END ! End If
- SETCURSOR() ! Reset to Normal Cursor
- LocalResponse = RequestCompleted ! Set Request Completed
- BREAK ! Exit Delete Loop
- END !End Loop
-
-
-
-
-