Module List.pkg
1//************************************************************************
2//
3// Confidential Trade Secret.
4// Copyright 1987-1992 Data Access Corporation, Miami FL, USA
5// All Rights reserved
6// DataFlex is a registered trademark of Data Access Corporation.
7//
8// $Source: k:\RCS\.\pkg\list.pkg,v $
9// $Revision: 1 $
10// $State: Exp $
11// $Author: james $
12// $Date: Dec 02 09:39:25 1996 $
13// $Locker: $
14//
15// $Log: list.pkg,v $
16//Revision 2.3 1994/01/10 19:35:29 james
17//Removed code associated with verify_data_loss_msg function. It needs
18//to a stub ( according to Lee ).
19//
20//Revision 2.2 1993/11/09 17:19:46 lee
21//added verify_data_loss and verify_data_loss_msg functions as stubs
22//so that request_cancel can call these functions in selection lists
23//and pick lists w/o errors. (these classes don;'t suypport the verify
24//protocol so these messages must be stubbed out.).
25//
26//Revision 2.1 93/08/25 17:49:11 17:49:11 james (James Ricci)
27//Adding new main branch
28//
29//Revision 1.2 1993/04/28 00:20:34 james
30//Initializing 3.04 source code.
31//
32//Revision 1.1 1992/09/08 14:43:07 james
33//Initial revision
34//
35//Revision 1.9 92/06/06 01:57:36 lee
36//added register_procedure move_value_out
37//
38//Revision 1.8 92/05/29 14:06:13 lee
39//removed end_construct_* messages from mixins; now, classes that use the mixin
40//send the message that used to be sent by the end_construct_* message (for
41//efficiency).
42//
43//Revision 1.7 92/05/14 15:53:34 unknown
44//Updated Copyright slug - SWM.
45//
46//Revision 1.6 92/04/01 00:33:32 lee
47//removed navstart and liststart (unused), renamed bind_main_file and bind_index
48//in datalist to bind_list_main_file and bind_list_index to avoid conflict with
49//commands used by data_set, moved bind_static from sellist to datalist as it
50//only sets properties defined in datalist (not sellist).
51//
52//Revision 1.5 92/03/29 18:45:01 lee
53//added MSG_END_CONSTRUCT_OBJECT, moved ENDMAC macro stuff into END_CONSTRUCT-
54//OBJECT procedures (in .pkgs). moved Flag_ITems to list.pkg after generalizing
55//it based on PROTOTYPE_OBJECT instead of Whether or not it is a table-oriented
56//object. Moved define_access_keys mechanism completely into actionbr.pkg.
57//fixed two typos: import_class_protocol used !# instead of !3, and register-
58//procedure used !1 instead of !2.
59//
60//Revision 1.4 92/03/09 19:03:16 james
61//Added #CHKSUB directive to insure source
62//only compiled with correct revision of
63//compiler.
64//
65//Revision 1.3 92/02/12 17:46:53 steve-l
66//Bind_Target corrected - was skipping arg !2 on recursion
67//
68//Revision 1.2 91/11/08 09:23:28 steve-l
69//it
70//
71//************************************************************************/
72
73//************************************************************************
74// list_mx0 extensions
75// Version: 1.0
76// 12-14-1992 : Created
77//
78// Author: John J. Tuohy
79//
80//
81// This module defines the properties and operations required to support
82// modified list classes pick_list0 and selection_list0. These support
83// Move_Value_Out_State property
84//
85//************************************************************************/
86// 12/22/94 - JJT Merge changes
87// Moved Move_value_out_state from list0_mx.
88// Use OK from list0_mx with minor change of init_selected_item.
89// Added public message init_selected_item.
90// removed Activating, popup and deactivating. They are replaced
91// by an augmentation to set popup_state and Set
92// Popup_side_effects (this makes the changes augmentable).
93// Removed Insert_item, Add_item, Toggle_select and Flag_items
94// (classes sellist and picklist are now responsible for making
95// them work).
96// 03/10/95 (JJT) Made Move_value_out_state also set auto_fill_State.
97// When used in move value out popups we want it false.
98// This is done directly when the popup is set on the list
99// (bind_SelList_popup - which we can now remove). We lose this
100// when in a client. The logic for this can and should be
101// improved.
102// 09/04/95 JJT - Code Clean up (removed dead commented code)
103//************************************************************************/
104
105//************************************************************************
106// File Name: List.Pkg
107// Creation Date: January 1, 1991
108// Modified Date: Feb 12, 1992
109// Author(s): Steven A. Lowe
110//
111// This module defines the properties and operations required to support
112// list-selection, collected in the abstract class List_Mixin.
113//
114// This file should be USEd prior to and IMPORTed within the scope of the
115// class definition by any user-interface (esp. data-entry) class which
116// must support the data-entry object standards.
117//
118// This file is used by PICKLIST.PKG and SELLIST.PKG.
119//************************************************************************/
120// VDF changes:
121// 9/4/97 JJT Changed OK to send default_action instead of Next. This makes
122// this consistent with our new default_button and Enter behaviors.
123// Note that this only gets executed with non-popup types of lists.
124// Popup lists work as they always did.
125//
126#CHKSUB 1 1 // Verify the UI subsystem.
127
128use VDFBase.pkg
129
130register_procedure move_value_out
131Register_Function Move_value_Out_State Returns Integer
132
133class list_mixin is a mixin
134
135 //
136 // Description
137 //
138 // This procedure defines the accelerator keys and properties required
139 // to support the standard list-selection options.
140 //
141 // Assumptions/Preconditions
142 //
143 // This procedure should only be invoked from within the Construct_Object
144 // procedure of a class.
145 //
146 // Exceptions
147 //
148 // None.
149 //
150 // Notes
151 //
152 // Enumeration_Counter is used to scan selected items.
153 //
154 // Export_Item_State determines if the value of the selected item in a
155 // single-select or auto-select list should be placed into the current
156 // item of the object which 'invoked' the list (i.e. the object which
157 // had the focus when this object was activated - see Invoking_Object_ID).
158 //
159 // Invoking_Object_ID is the object id of the object which had the focus
160 // when this object was activated.
161 //
162 // Original_Selection is the item# (if batch) or record number (if virtual)
163 // of the item which was selected when the list was activated.
164 //
165 // Radio_State determines if the items in this list are radio-buttons.
166 //
167 // Target_Field identifies the field (in the Target_File), if any, which
168 // should receive the value of the currently selected item during a save
169 // operation (i.e. when the Entry_Update message is received during a
170 // save operation). This only applies to single-select or auto-select
171 // lists, not multi-select or no-select lists.
172 //
173 // Target_File identifies the file, if any, which has a field that should
174 // receive the value of the currently selected item during a save operation
175 // (see Target_Field).
176 //
177 { MethodType=Event Visibility=Private }
178 procedure define_list
179 set select_mode to SINGLE_SELECT
180 set search_mode to INCREMENTAL
181 on_key kCancel SEND CANCEL PRIVATE
182 on_key kEnter SEND OK PRIVATE
183 on_key kSpace SEND Toggle_Select PRIVATE
184 { Visibility=Private }
185 Property integer Enumeration_Counter 0
186 { Category=Behavior }
187 { PropertyType=Boolean }
188 Property Integer Export_Item_State False
189 { Category=Behavior }
190 Property integer Invoking_Object_ID 0
191 { DesignTime=False }
192 Property integer Original_Selection 0
193 { Visibility=Private Obsolete=True }
194 Property integer Radio_State 0
195 { Visibility=Private Obsolete=True }
196 Property integer Target_Field 0
197 { Visibility=Private Obsolete=True }
198 Property integer Target_File 0
199 { Visibility=Private }
200 Property integer Private.Move_Value_Out_State False
201 end_procedure
202
203 // Augment Popup_state to set other (side effect) properties
204 //
205 // (JJT) This makes more sense than changing deactivating and
206 // popup - I still don't like it!!!
207 // Better to use Modal_state
208 { MethodType=Property Obsolete=True }
209 { DesignTime=False }
210 { PropertyType=Boolean }
211 Procedure Set Popup_State Integer Fg
212 Forward Set Popup_State to Fg
213 Set Popup_Side_Effects to Fg
214 End_Procedure
215
216 // Setting popup_state in lists (sel-list, pick-lists) etc must set other
217 // prorperties as well. We assume that a list popup is modal, scoped and
218 // will export it selection. Note that this does not get called when a
219 // popup client is used to contain a list. Usually in that case the
220 // block_mouse_state and scope_state should be set at the client while
221 // move_value_out_state still must be set in this object.
222 //
223 { Visibility=Private }
224 procedure SET Popup_Side_effects Integer Fg
225 // set any other properties you want based on this property
226 set Block_Mouse_State to Fg
227 set Scope_State to Fg
228 Set Move_Value_Out_State to Fg
229 end_procedure
230
231
232 //
233 // Description
234 //
235 // This procedure accepts the selected item(s) in the list, and surrenders
236 // the focus.
237 //
238 // The incremental-search index is reset.
239 //
240 // The value of the current item may be exported to the current item of the
241 // invoking object, and this object deactivated, if this object is
242 // move_value_out_state true, or the focus may be given to the next object
243 // in the rotation order.
244 //
245 // Assumptions/Preconditions
246 //
247 // This object (or one or its ancestor classes) must understand the
248 // Move_Value_Out message as a method of exporting a value, the
249 // Request_Cancel message as a method of deactivating this object, and
250 // the Next message as a method of rotating to the next focusable object.
251 //
252 // Exceptions
253 //
254 // None.
255 //
256 // Notes
257 //
258 // Sent by kENTER.
259 //
260 procedure Ok returns integer
261 integer selMode
262 set search_mode to (search_mode(self)) //reset incr srch index
263 if (Move_Value_Out_state(self)) begin
264 get select_mode to selMode
265 //**jjt** set select_state item CURRENT to true
266 //if ((SelMode = SINGLE_SELECT OR SelMode = AUTO_SELECT) AND ;
267 // Select_Count(self) > 0) send move_value_out
268 if SelMode ne MULTI_SELECT ;
269 send move_value_out
270 else send Init_selected_item //multi-select or none selected
271 send request_cancel
272 end
273 else send default_action // this will normally delegate.
274 // We used to send next. Sending default_action is more consistent with
275 // the new default button behaviors. Enter will now do whatever enter is
276 // supposed to do for entire app (next or nothing).
277// else send NEXT
278 end_procedure
279
280 // **jjt**
281 // public message to init the selected item counter. Enumeration_Counter
282 // is too cryptic
283 Procedure Init_Selected_Item
284 Set enumeration_counter to 0
285 End_Procedure
286
287
288 //
289 // Description
290 //
291 // This function returns the message id to be used to verify an operation
292 // which may cause the user to lose changes to the data in items. It is
293 // overridden here to return 0 because (popup) lists do not support the
294 // verification protocol.
295 //
296 // Assumptions/Preconditions
297 //
298 // This object must understand Component_State.
299 //
300 // Exceptions
301 //
302 // If this object's Verify_Data_Loss_Msg is 0, the value of this object's
303 // parent's Verify_Data_Loss_Msg is returned, if any.
304 //
305 // Notes
306 //
307 // None.
308 //
309 { MethodType=Property Visibility=Private }
310 function Verify_Data_Loss_Msg returns integer
311 function_return 0
312 end_function
313
314 //
315 // Description
316 //
317 // This is a stub because for the proper operation of request_cancel.
318 //
319 // Assumptions/Preconditions
320 //
321 // None.
322 //
323 // Exceptions
324 //
325 // None.
326 //
327 // Notes
328 //
329 // None.
330 //
331 { Visibility=Private }
332 function Verify_Data_Loss returns integer
333 function_return 0
334 end_function
335
336 // **JJT** Modified to also set auto_fill_State
337 //
338 // I don't like this, but it is the best I can come up with. Popup
339 // lists that are designed to selection items need to have auto-fill-
340 // state set to true. This can not be tied to popup. It is most closely
341 // tied to this property. If for some reason you don't want these set
342 // together you will need to set auto_fill_state AFTER you set
343 // move_value_out_state.
344 //
345 { MethodType=Property }
346 { InitialValue=True }
347 { Category=Behavior }
348 { PropertyType=Boolean }
349 Procedure Set Move_Value_Out_State Integer st
350 Set Private.Move_Value_out_State to St
351 Set Auto_Fill_State to (not(st))
352 End_Procedure // Set Move_value_out_State
353
354 // See above
355 { MethodType=Property }
356 Function Move_Value_Out_State Returns Integer
357 function_return (Private.Move_Value_out_State(self))
358 End_Function // Move_Value_Out_State
359
360
361end_class
362
363
364
365