Module clear_mx.pkg
1//************************************************************************
2//
3// Confidential Trade Secret.
4// Copyright 1987-1995 Data Access Corporation, Miami FL, USA
5// All Rights reserved
6// DataFlex is a registered trademark of Data Access Corporation.
7//
8//************************************************************************
9
10//************************************************************************
11// Clear_mx.Pkg
12// Version: 1.0
13// 07/18/94 - Created
14//
15// Author: John J. Tuohy
16//
17// Augmentations:
18// Entry_Clear
19// Entry_Clear_all
20//
21// mixin package DEOs (table, entry_form) to support defaults after a
22// a clear (either through retains or Entry_Defaults). Added to
23// enform0.pkg and table0.pkg
24//
25// 09/11/94 - added same support to entry_clear_all (whoops forgot)
26//
27// 12/22/94 JJT - Removed Change_disabled_state (to server)
28// Changed_state augmentation in server
29//
30// 05/25/95 JJT - Entry_clear/clear_all only passes one param (not two)
31// 08/29/95 JJT - Modified entry_clear and entry_clear_all to only send
32// entry_defaults when the server's main-file was part
33// of the clear. Entry_defaults was getting called too
34// often.
35// 09/04/95 JJT - Code Clean up (removed dead commented code)
36//************************************************************************
37
38use VDFBase.pkg
39
40{ ClassType=Mixin }
41Class Clear_Defaults_Mixin is a mixin
42
43 { Visibility=Private }
44 Procedure Define_Clear_Defaults
45 // Defined for backwards compatability. If you don't like the new
46 // behavior, set this property to false. This only effects retains.
47 // Avoid using this if possible.
48 { Category=Data }
49 { PropertyType=Boolean }
50 Property Integer Retain_No_Change_State True
51 End_Procedure // Define_Clear_Defaults
52
53 { Visibility=Private }
54 Procedure Entry_Clear Integer fg1
55 Integer Oldst srvr file#
56 Get Change_Disabled_State to OldSt
57 If (Retain_no_Change_state(self)) Begin
58 Set Change_Disabled_State to TRUE
59 Forward Send Entry_Clear fg1
60 set Change_Disabled_State to OldSt
61 set Changed_State to False
62 End
63 Else Forward Send Entry_Clear fg1
64 //
65 // only do entry-defaults if a dso is used and the
66 // dso's main-file was cleared.
67 Get Server to srvr
68 if srvr begin
69 get main_file of srvr to file#
70 is_file_included file# 0
71 [found] begin
72 Set Change_Disabled_State to TRUE // for Entry_defaults
73 Send Entry_Defaults
74 Set Change_Disabled_State to OldSt
75 end
76 end
77 End_Procedure
78
79
80 // Augmented to do the same tricks as entry_Clear
81 //
82 { Visibility=Private }
83 Procedure Entry_Clear_All Integer fg1
84 Integer Oldst srvr file#
85 Get Change_Disabled_State to OldSt
86 If (Retain_no_Change_state(Self)) Begin
87 Set Change_Disabled_State to TRUE
88 Forward Send Entry_Clear_all fg1
89 set Change_Disabled_State to OldSt
90 set Changed_State to False
91 End
92 Else Forward Send Entry_Clear_all fg1
93 //
94 // only do entry-defaults if a dso is used and the
95 // dso's main-file was cleared.
96 Get Server to srvr
97 if srvr begin
98 get main_file of srvr to file#
99 is_file_included file# 0
100 [found] begin
101 Set Change_Disabled_State to TRUE // for Entry_defaults
102 Send Entry_Defaults
103 Set Change_Disabled_State to OldSt
104 end
105 end
106 End_Procedure
107
108
109 // Public Hook: Set Defaults after a clear. Should be augmented
110 // Should NOT be sent.
111 //
112 { MethodType=Event }
113 Procedure Entry_Defaults
114 End_Procedure // Entry_Defaults
115
116 // Set an item's value and item_changed_state. This just happens so often
117 // that it is worth creating a message for
118 //
119 { MethodType=Property }
120 Procedure Set Changed_Value integer Item# String Val
121 Set Value Item Item# to Val
122 Set Item_Changed_State Item Item# to TRUE
123 End_Procedure // Set Changed_Value
124
125 // Set an item's value and item_changed_state without changing the
126 // object's changed_state. Good for setting defaults without triggering
127 // a data-loss condition.
128 //
129 { MethodType=Property }
130 { Category=Data }
131 Procedure Set Default_Value integer Item# String Val
132 Integer Oldst
133 Get Change_Disabled_State to OldSt // As it was in the beginning
134 Set Change_Disabled_State to TRUE // though changed by the tides
135 Set Changed_Value Item Item# to Val //
136 Set Change_Disabled_State to OldSt // it will be as it was. Amen
137 End_Procedure // Set Entry_Value
138
139End_Class
140