Module Dd_deomx.pkg
1//************************************************************************
2// Confidential Trade Secret.
3// Copyright (c) 1997 Data Access Corporation, Miami Florida
4// as an unpublished work. All rights reserved.
5// DataFlex is a registered trademark of Data Access Corporation.
6//
7//************************************************************************
8//****************************************************************************//
9// //
10// $File name : DD_DEOMX.PKG //
11// $File title : //
12// Notice : //
13// $System : Extended Data Sets 3.1 //
14// Created : 16-02-96 @ 17:33:31 //
15// $Last Rev : 29-02-96 @ 14:24:41 //
16// //
17// $Description //
18// //
19// //
20// $Rev History //
21//JT 4/14/99 Change entry_defaults to set defaults on parent if //
22// allow_foreign_new_save_state is true //
23//JT 12/1/97 procedure set checkbox_item had missing ";" in else //
24//JT 10/14/97 Made copy_mask_options more flexible. If mask created in the //
25// Deo, no not alter it. //
26//JT 8/13/97 Altered to support prompt_button_mode logic //
27//JT 07/28/97 Altered entry_display and entry_clear to disable updates //
28// from the focus object (if an xDEO) as well as the current //
29// object. Otherwise get_field_values to DD may return a DEO's //
30// value that has not yet been cleared (e.g., one view with two //
31// DEOs using same field. Focus is in DEO2. When cleared, the //
32// default for DEO1 would incorrectly get the field value from //
33// the second yet to be cleared focus field). //
34//JT 6/24/97 Added auto-label support. Created Auto_Label_State and added //
35// Assign_DD_Label //
36//JT 01/18/97 Fixed entry_display to not set checkbox if the file is not in //
37// the done array. This was causing DD defaults to cleared //
38//JT 12/10/96 Notify_Focus_Change checks to see if it within an error //
39// condition. If it is, it should not update the DD. //
40//JT 09/17/96 Added messages Get_Item_Buffer_Select_State which determines //
41// sel-state based on item's filebuffer and not the dd buffer. //
42// needed by entry_display which must always deal with file buffers//
43// and not dd buffers (because of tables). Modified entry_display. //
44// Fixed bug where entry_display was checking all items and not //
45// just the current row.
46//JT 09/13/96 Change in NoPut logic. If DEO is NoPut the DDO is not notified //
47// of value or item_change changes. It is expected that save will //
48// update DD buffer but finds will update DEO buffer. Also NoPut //
49// key input is not synchronized with other DEOs. Set Value, Set //
50// item_changed_state, Set Select_state, Update_focus_field and //
51// get entry were altered to honor NoPut. New message Item_noPut //
52// is used to check noput deo status //
53//JT 08/12/96 Set_Checkbox_item supports 1 or 3 args (for non DD use) //
54//JT 07/18/96 Added mask support in Copy_Item_Options (IFDEFed to only work //
55// with windows. It calls Copy_Mask_Options //
56//JT 06/27/96 Item_Validate is skipped if item is shadowed //
57//JT 04/26/96 Created Entry_Refresh_State to stop DD update during entry_ //
58// update, entry_display, entry_defaults. This should be //
59// revisited. //
60//JT 04/25/96 File_Field_Value & Item_Field_Value changed to File_Field_ //
61// Current_Value and Item_Field_Current_Value. We //
62// can't use Get/Set_Field_Value because it is a 3.1 command. //
63//JT 04/20/96 Modified so DD deo classes can be used with non-DD data-sets //
64// (Implemented Extended_DSO_State and Extended_DEO_State). This //
65// makes it possible to mix DS and DD views within the same program//
66// without needing to rename _DS classes. Attach_Deo_to_Server //
67// checks data-set type and assigns extended_deo_state as needed. //
68//JT 04/16/96 Moved DF class defintions out to the actual classes (Dfenter. //
69// pkg, etc.) Renamed to DDDEO_MX.PKG //
70//JT 31-03-96 Entry_Defaults only sets the values if the item's file is the //
71// server's main-file. I think this is correct! //
72//JT 31-03-96 Moved Combo Mixin USE into this package at the end. //
73//JT 31-03-96 Server.pkg now calls Define_Deo_Extended_mixin. Server.pkg //
74// has stubbed procedures to handle this when XDEO is not used //
75//JT 28-03-96 Created Set Local_Value which allows one to set a value without //
76// going through the DSO. Changed messages to use this. //
77//JT 28-03-96 Created get_Data_Value which returns value. Can be used for //
78// augmentation (combos). Also, called by xdataset //
79//JT 28-03-96 Created new mixin Extended_DEO_Spin_Mixin (will move it) //
80//JT 28-03-96 Major changes to support validation tables. This provides //
81// support for spinners and combo boxes. //
82//JT 23-03-96 Removed all old dead code. Removed Item_option commands //
83//JT 22-03-96 Created Status_Help to ask the DSO for a help field value //
84//JT 21-03-96 Overhauled the update logic for windows to make sure that //
85// changed values always make it to the field buffer. This is //
86// below. We removed process_accelerator and added the messages //
87// Notify_Focus_Change (augment) and Update_Focus_Field (new) //
88//JT 21-03-96 Created function Extended_DEO_State. DEOs return TRUE all others//
89// return false. This is always checked before DSO sends to DEO //
90//JT 20-03-96 Major changes to support checkboxes in DSO and DEOs. Added an //
91// extended type for checkboxes. Added Select_state logic. //
92// This required the following new or augmented Messages: //
93// Send Entry_Update //
94// Set CheckBox_Item //
95// Set Select_State //
96// Get/Set File_Field_Select_State (new) //
97// : Get/Set Item_Field_Select_State (new) //
98//JT 20-03-96 Modified Set File_field_Value_Changed to accept an additional //
99// parameter indicating if this is a Default change in which case //
100// item_changed_state is set but changed_state is not set. //
101//JT 19-03-96 Created entry_update to not perform entry_update during a save, //
102// the DSO should handle this. A property, allow_save_entry_update //
103// can override this. //
104//JT 19-03-96 Altered ENTRY to send item_field_Value //
105//JT 19-03-96 Altered set Value to not forward if DSO gets message. If DSO //
106// receives message it will indirectly update this value allowing //
107// us to not worry about double updating the item. This allows us //
108// to remove accelerator_object checking (which I did). //
109//JT 19-03-96 Removed entry_display_in_progess and the entry_display //
110// augmentation. Value now checks operation_mode to see if it //
111// should update the value to the data-set. //
112//JT 19-03-96 Added SET Item_Field_Changed_State //
113//JT 19-03-96 Modified Set item_Changed_State to only set the field's //
114// changed-state. Setting the value was doing to much. //
115//JT 17-03-96 Changed Item_xxxxx (validate_msg, exit_msg, entry_msg) to //
116// Field_xxxxx. This is more consistent with the rest of the //
117// data_set interface. //
118//JT 17-03-96 Changed all DD references to DS //
119//JT 17-03-96 Changed File_field_item_Option to File_Field_Option //
120//EK 02-29-96 Added Entry_Display augmentation to set Entry_Display_In_ //
121// Progress. //
122//EK 02-29-96 Changed SET_Value to respect Entry_Display_In_Progress. //
123//EK 02-29-96 Added Entry_Display_In_Progess to stop notifying the server //
124// from a SET_Value while Entry_Display-ing. //
125//EK 02-29-96 Added Entry_Defaults replacement. //
126//EK 02-27-96 Put in compiler directives to exclude the augmentation of //
127// Process_Accelerator when compiling under CM. //
128//EK 02-23-96 Changed Item_Value_Changed to set the Item_Changed_State of the //
129// item to TRUE. Currently this is only done for CM applications. //
130//EK 02-21-96 Changed Item_Entry and Item_Exit. Both missed a ';' after the //
131// test on Object_Item_Entry_Exit. //
132//EK 02-21-96 Changed Ifnot into If Not. //
133//EK 02-21-96 Changed Scan_Servers to send Find_Server_To_Watch when it is //
134// being compiled without the Windows stuff. //
135//EK 02-20-96 Created procedure Item_Value_Changed and modified File_Field_ //
136// Value_Changed to sent this message instead of setting the //
137// value of the item directly. //
138//EK 02-20-96 Changed Copy_Item_Options into Copy_All_Item_Options and //
139// Copy_Item_Option into Copy_Item_Options. //
140//EK 02-20-96 Augment Set Highlight_State to trap a value change of an item //
141// by a user. //
142//EK 02-20-96 Created procedure Define_Extended_DEO_Mixin. //
143//EK 02-20-96 Added __X__ symbols for Item_Field_Changed_State and Item_ //
144// Field_Value for default item numbers. //
145//EK 02-19-96 Changed Item_Validate. It now calls File_Field_Validate_Field //
146// of the server. //
147//EK 02-19-96 Added Item_Field_Property function //
148//EK 02-19-96 Changed Copy_Item_Option to include the file number to let the //
149// server decide to use Foreign_Options or not. //
150//EK 02-16-96 Added Item_Field_Changed_State //
151//EK 02-16-96 Added File_Field_Changed_State //
152//EK 02-16-96 File header created //
153// //
154//****************************************************************************//
155Use Windows.pkg
156Use DataDict.pkg
157Use EntItem.pkg
158
159#IFNDEF ddrtsNone
160Enum_List
161 Define ddrtsNone
162 Define ddrtsFound
163 Define ddrtsCleared
164End_Enum_List
165#ENDIF
166
167//************************************************************************//
168// These replaces help the compiler to automatically add 'Current_item' //
169// when one of these messages will be sent and the item keyword has been //
170// left off. //
171//************************************************************************//
172
173#REPLACE DFLT$Item_Field_Current_Value __X__
174#Replace DFLT$ITEM_FIELD_CHANGED_STATE __X__
175
176Register_Function pbUseDDOStatusHelp Returns Handle
177
178//************************************************************************//
179// Extended_DEO_Mixin //
180// This mixin-class contains all necessary methods to support Extended_ //
181// Data_Sets. //
182// //
183//************************************************************************//
184
185//************************************************************************//
186// Synchronization Logic for DEOs and DSOs //
187// //
188// Whenever a change is made in an item this value must be also changed //
189// in the Data-set local field buffer. Whenever the field buffer changes //
190// the DEO must get notified. In addition, any time item_change_state is //
191// set to TRUE the DSO must get notified. //
192// //
193// Character Mode: In character mode we will augment the ENTRY function //
194// to maintain this. This will work in all cases except //
195// for checkboxes which do not use this function. We also //
196// trap set select_state to handle this. In addition, if //
197// the developer directly does a set_value we will trap //
198// this and make sure that the DSO is updated. When the //
199// DSO is updated it changes its buffer and it notifies //
200// all affected DEOs about the data-change. This provides //
201// for a dependent item support. //
202// //
203// Windows: In windows we have no entry function. In fact there are//
204// times where there will be focus/event change at all at //
205// the end of an entry (the menus generate no Windows or //
206// DF focus messages. This means that the focus value may //
207// not be updated in the DSO. We solve this by augmenting //
208// GET_field_value in the DSO. If the file/field being //
209// retreived is the focus file/field we get the data from //
210// DEO and not the local DSO buffer. Any time the focus //
211// changes we update the DSO. The only time we may not be //
212// in synch. is the focus object. We adjust for this. We //
213// use the notify_focus_change message to update the //
214// field buffer. Also, in the DSO the buffers are aligned //
215// before an entry_update can occur (this was another //
216// hole). This is not an issue for checkbox items since //
217// set select_state is always sent and redirected to the //
218// DSO. //
219//************************************************************************//
220
221
222Class Extended_DEO_Mixin is a mixin
223
224 //************************************************************************//
225 // Procedure Define_Extended_DEO_Mixin //
226 // This must be called upon creation of a DEO object to create and //
227 // initialize some properties. This is called by Server.pkg mixin //
228 //************************************************************************//
229
230 { Visibility=Private }
231 Procedure Define_Extended_DEO_Mixin
232 { Visibility=Private }
233 Property Integer Extended_DEO_State False
234
235 { Visibility=Private }
236 Property Integer Allow_Save_Entry_Update False
237
238 { Visibility=Private }
239 Property Integer Entry_Refresh_State False
240
241 { Category=Appearance }
242 { PropertyType=Boolean }
243 Property Integer Auto_Label_State False
244 End_Procedure
245
246//#IFDEF IS$WINDOWS
247
248 //************************************************************************//
249 // Procedure Notify_Focus_Change Integer iState //
250 // This procedure is used to trap a change of the value of this item //
251 // by user input. //
252 // Windows sends this whenever the windows focus changes. When the focus //
253 // is lost, we make sure that our field buffer is updated and all //
254 // dependent items are updated. //
255 //************************************************************************//
256 Register_Function Error_Processing_State returns integer
257
258 { MethodType=Event Visibility=Private }
259 Procedure Notify_Focus_Change Integer iState
260 Forward Send Notify_Focus_Change iState
261
262 If (not(iState) AND Extended_deo_State(self)) Begin // leaving the object update
263 // If the focus change is part of an error condition we should not
264 // report the error (the focus change is the message box popping up).
265 If (Error_Object_ID=0 OR Error_Processing_State(Error_Object_ID)=0) ;
266 Send Update_Focus_Field // the focus value
267 End
268 End_Procedure
269
270 //************************************************************************//
271 // Function Item_Noput //
272 // Returns true if the item has the noput option set //
273 //************************************************************************//
274
275 { MethodType=Property Visibility=Private }
276 Function Item_NoPut integer iItem returns integer
277 handle hoServer
278 integer iFile iField
279 Get Server to hoServer
280 Get Data_File iItem to iFile
281 Get Data_field iItem to iField
282 If (hoServer AND iFile) ;
283 Function_return ( (File_field_options(hoServer,iFile,iField) IAND DD_NOPUT)<>0 )
284 // prior to 8.1 this just returned the noput value of the item option. It seems like it
285 // makes more sense to return the noput value of the DD. In addition, as of 8.1 noput is
286 // not directly set in the DEO. It should be set in the DD
287 End_Function // Item_NoPut
288
289 //************************************************************************//
290 // Procedure Update_Focus_Field //
291 // Update the focus field value and place it in the local DSO buffer. //
292 // This will also update all dependent items. Only do this if appropriate //
293 // This message is sent when the windows focus changes and is also sent //
294 // berfore an entry_update is processed in the DSO //
295 //************************************************************************//
296
297 { Visibility=Private }
298 Procedure Update_Focus_Field
299 Integer iItem
300 Get Current_Item to iItem
301 If (Item_Changed_state(self,iItem) AND ;
302 Data_File(self,iItem) AND ;
303 (CheckBox_item_State(self,iItem)=0) AND ; //ckboxes are always up to date
304 (Item_NoPut(self,iItem)=0) ) ;
305 Set Item_Field_Current_Value item iItem to (Value(self,iItem)) // indirectly update the value
306 End_Procedure // Update_Focus_Field
307
308
309//#ELSE
310
311// //************************************************************************//
312// // Function Entry //
313// // Augmented to keep track of changes in Value. Only for CM applications. //
314// //************************************************************************//
315
316// Function Entry Returns Integer
317// Integer iResult
318// String sOld_Value
319// String sNew_Value
320// Integer iItem
321
322// If Not (Extended_deo_State(self)) Begin
323// Forward Get Entry to iResult
324// Function_Return iResult
325// End
326
327// Get Current_Item to iItem
328// Get Value item iItem to sOld_Value
329// Forward Get Entry to iResult
330// Get Value item iItem to sNew_Value
331// If (Item_Changed_State(self,iItem) AND ;
332// sOld_Value<>sNew_Value AND ;
333// (Item_NoPut(self,iItem)=0) ) ;
334// Set Item_Field_Current_Value item iItem to sNew_Value
335// Function_Return iResult
336// End_Function
337
338// //************************************************************************//
339// // Procedure Update_Focus_Field //
340// // This should not be needed at all in character mode. //
341// //************************************************************************//
342
343// Procedure Update_Focus_Field
344// End_Procedure
345//#ENDIF
346
347 //************************************************************************//
348 // Function Item_Field_Property //
349 // This function has been created to have an easy way of getting a //
350 // field based property value from a fields server. //
351 //************************************************************************//
352
353 { Visibility=Private }
354 Function Item_Field_Property Integer iMsg Integer iItem Returns String
355 Integer iDSO
356 Integer iFile
357 Integer iField
358 Integer iCols
359 String sValue
360 Handle hoEle
361 Get Server to iDSO
362 If iDSO Begin
363 Get Prototype_object to hoEle // use prototype in case this is an empty dbgrid
364 // if we have columns, we want the column number
365 If (iItem=CURRENT) Begin
366 Get Current_Item to iItem
367 End
368 Get Item_Limit to iCols // items in row
369 If (iCols<>0) Begin
370 Move (Mod(iItem,iCols)) to iItem
371 end
372 Get Data_File of hoEle iItem to iFile
373 If iFile Begin
374 Get Data_Field of hoEle iItem to iField
375 Get iMsg of iDSO iFile iField to sValue
376 End
377 End
378 Function_Return sValue
379 End_Function
380
381
382
383 //************************************************************************//
384 // Procedure File_Field_Value_Changed //
385 // This message will be send by Data_Sets whenever a value of a field //
386 // changes. This way DEOs can update their values if necessary. //
387 //************************************************************************//
388
389 { Visibility=Private }
390 Procedure File_Field_Value_Changed Integer iFile Integer iField ;
391 String sValue Integer iChangeDisabled
392 Integer iMax
393 Integer iCount
394 Integer iBase
395 Integer iData
396 Integer iOldState
397 Get Item_Count to iCount // items in object
398 Get Item_Limit to iMax // items in row
399 If iMax EQ 0 ;
400 Move iCount to iMax // if no row, use num items
401 Get Base_Item to iBase // first item to check
402 Move ( iBase + iMax - 1 ) to iMax // last item to check
403 If iCount GT iMax Begin // in case table is a blank row!
404 For iCount from iBase to iMax
405 Get Data_File item iCount to iData
406 If iData EQ iFile Begin
407 Get Data_Field item iCount to iData
408 If iData EQ iField Begin
409 If iChangeDisabled Begin
410 Get Change_Disabled_State to iOldState
411 Set Change_Disabled_State to TRUE
412 Send Item_Value_Changed iCount sValue
413 Set Change_Disabled_State to iOldState
414 End
415 Else ;
416 Send Item_Value_Changed iCount sValue
417 End
418 End
419 Loop
420 End
421 End_Procedure
422
423 //************************************************************************//
424 // Procedure Entry_Defaults //
425 // This procedure will be called automatically after a clear operation on //
426 // this DEO. We do not need to set the Change_Disabled_State because this //
427 // is already been done for us. //
428 //************************************************************************//
429
430 // this is needed by combos in grids and will be augmented in a sub-class to do stuff
431 { MethodType=Event Visibility=Private }
432 Procedure ColumnComboEntryDefaults integer iItem integer iFile integer iField
433 end_procedure
434
435 { MethodType=Event Visibility=Private }
436 Procedure Entry_Defaults
437 String sValue
438 Integer iMax iCount iBase
439 Integer iData_File iData_Field iDSO_File
440 boolean bOldState bOk
441 handle hoEle hoDSO
442
443 Get Server to hoDSO
444 Get protoType_object to hoEle
445
446 If Not (Extended_deo_State(self)) Begin
447 Forward Send Entry_Defaults
448 Procedure_Return
449 End
450
451 If Not hoDSO procedure_Return
452
453 Get Entry_Refresh_State to bOldState
454 Set Entry_Refresh_State to True
455
456 Get Main_File of hoDSO to iDSO_File
457 Get Item_Count to iCount // items in object
458 Get Item_Limit to iMax // items in row
459 If Not iMax ;
460 Move iCount to iMax // if no row, use num items
461 Get Base_Item to iBase // first item to check
462 Move (iBase + iMax - 1) to iMax // last item to check
463 If iCount GT iMax Begin // in case table is a blank row!
464 For iCount from iBase to iMax
465 Get Data_File iCount to iData_File
466 If iData_File Begin
467 Get Data_Field iCount to iData_Field
468 // if DDO field is changed, it must be a default, set it accordingly.
469 Get File_field_Changed_state of hoDso iData_file iData_Field to bOk
470 if bOk Begin
471 Get File_Field_Current_Value of hoDSO iData_File iData_Field to sValue
472 Send Item_Value_Changed iCount sValue
473 end
474 else begin
475 // entry-state=f combos need to make sure the DD has the save value as the combo-default value
476 Send ColumnComboEntryDefaults iCount hoDSO iData_file iData_field
477 end
478 end
479
480 Loop
481 End
482 Set Entry_Refresh_State to bOldState
483 End_Procedure
484
485// Procedure Entry_Defaults
486// String sValue
487// Integer iMax
488// Integer iCount
489// Integer iBase
490// Integer iData_File
491// Integer iData_Field
492// Integer iDSO
493// Integer iDSO_File
494// integer iOldState
495// integer bOk
496// integer iOwnerDD
497// Get Server to iDSO
498
499// If Not (Extended_deo_State(self)) Begin
500// Forward Send Entry_Defaults
501// Procedure_Return
502// End
503
504// If Not iDSO ;
505// Procedure_Return
506
507// Get Entry_Refresh_State to iOldState
508// Set Entry_Refresh_State to True
509
510// Get Main_File of iDSO to iDSO_File
511// Get Item_Count to iCount // items in object
512// Get Item_Limit to iMax // items in row
513// If Not iMax ;
514// Move iCount to iMax // if no row, use num items
515// Get Base_Item to iBase // first item to check
516// Move (iBase + iMax - 1) to iMax // last item to check
517// If iCount GT iMax Begin // in case table is a blank row!
518// For iCount from iBase to iMax
519// Get Data_File item iCount to iData_File
520// If iData_File Begin
521// Get Data_Field item iCount to iData_Field
522// // if DDO field is changed, it must be a default, set it accordingly.
523// Get File_field_Changed_state of iDso iData_file iData_Field to bOk
524// if bOk Begin
525// Get File_Field_Current_Value of iDSO iData_File iData_Field to sValue
526// Send Item_Value_Changed iCount sValue
527// end
528// end
529//// Removed conditional check. If defaults exist in the DDO they should be seen in the DEO. It's the
530//// DDOs that matter.
531//// If (iData_File=iDSO_File) ;
532//// move 1 to bOK // if not a parent, apply defaults
533//// Else If iDSO Begin
534//// // if field is a parent we only do defaults if
535//// // its DD has Allow_Foreign_new_Save_State set which indicates
536//// // that it supports saving new parents when a child is saved
537//// Get Data_set of iDSO iData_File to iOwnerDD // the DD which owns this data-file
538//// If iOwnerDD Get Allow_Foreign_new_Save_State of iOwnerDD to bOK
539//// end
540//// If bOK Begin
541//// Get Data_Field item iCount to iData_Field
542//// Get File_Field_Current_Value of iDSO iData_File iData_Field to sValue
543//// If (sValue <> "" AND sValue <> "0") ;
544//// Send Item_Value_Changed iCount sValue
545//// End
546//// End
547
548// Loop
549// End
550// Set Entry_Refresh_State to iOldState
551// End_Procedure
552
553 //************************************************************************//
554 // Procedure Item_Value_Changed //
555 // This procedure will be send by File_Field_Value_Changed when //
556 // it found an item it needs to update. This is a good augmentation //
557 // point for a programmer to do its own thing. // //
558 //************************************************************************//
559
560 { Visibility=Private }
561 Procedure Item_Value_Changed Integer iItem String sValue
562 integer iState
563 // NOTE: It should be FORWARD here to
564 // prevent circular value settings.
565 If (Checkbox_Item_State(self,iItem)) Begin
566 Get Item_Field_Select_State iItem to iState
567 Set Local_Select_State iItem to iState
568 //Forward Set Select_State item iItem to iState
569 End
570 Else ;
571 Set Local_Value item iItem to sValue
572 Forward Set Item_Changed_State item iItem to TRUE
573 End_Procedure
574
575 { MethodType=Property Visibility=Private }
576 Procedure Set Local_Value integer iItem String sValue
577 Forward Set Value item iItem to sValue
578 End_Procedure
579
580 { MethodType=Property Visibility=Private }
581 Procedure Set Local_Select_state integer iItem integer bState
582 Forward Set Select_state iItem to bState
583 End_Procedure
584
585
586 //************************************************************************//
587 // Procedure Set Value //
588 // This procedure is used to trap a change of the value of this item //
589 // by user input or by a programmers' action. It will call Item_Field_ //
590 // Value to notify the Data_Set of the value changes. Note that it will //
591 // only notify the Data_Set when there is a change in value. //
592 // //
593 //************************************************************************//
594
595 { MethodType=Property Nodoc=True }
596 Procedure Set Value Integer iItem String sValue
597 String OldVal
598
599 If Not (Extended_deo_State(self)) Begin
600 Forward Set Value item iItem to sValue
601 Procedure_Return
602 End
603
604 Get value item iitem to oldval
605 //showln "test! o=n " oldval ' ' svalue ' ' (oldval<>svalue)
606 If ( (Operation_mode=0) AND ;
607 (Entry_Refresh_State(self)=0) AND ;
608 (string(OldVal)<>string(sValue)) AND ;
609 (Data_File(self,iItem)) AND ;
610 (CheckBox_item_State(self,iItem)=0) AND ;
611 (Item_NoPut(self,iItem)=0) ) Begin
612 //showln "Yes: o=n " oldval ' ' svalue ' ' (oldval<>svalue)
613 Set Item_Field_Current_Value item iItem to sValue // indirectly update the value
614 end
615 Else ;
616 Set Local_Value item iItem to sValue
617 End_Procedure
618
619
620 //************************************************************************//
621 // Procedure Data_Value //
622 // Return the value of this item's data. In this case it _is_ the item's //
623 // value. This can be used to logically seperate display data and disk //
624 // data. Combos use this. This is called by the xdataset class. //
625 //************************************************************************//
626
627 { MethodType=Property Visibility=Private }
628 Function Data_Value Integer iItem returns String
629 Function_Return (Value(self,iItem))
630 End_Function // Data_Value
631
632
633 //************************************************************************//
634 // Procedure Set Item_Changed_State //
635 // This procedure is used to trap a change of the value of this item //
636 // by user input or by a programmers' action. It sets its DSO's field //
637 // changed_state to true also. //
638 //************************************************************************//
639
640 { MethodType=Property Nodoc=True }
641 Procedure Set Item_Changed_State Integer iItem Integer iState
642 boolean bOk
643 integer iOpts
644 integer iFile iField iServer
645 Forward Set Item_Changed_State item iItem to iState
646
647 If Not (Extended_deo_State(self)) ;
648 Procedure_Return
649
650// If (iState AND Operation_Mode=0 AND Item_NoPut(self,iItem)=0 ) ;
651// Set Item_Field_Changed_State item iItem to iState
652
653 // logic change for 8.3.
654 // In 8.2 we no longer set autofind in the DEO and we allow the DD to do the autofind. This created a problem
655 // where a failed autofind when a current record already exists did not trigger an autofind on a noput field.
656 // We will now set field changed state of noput fields, if the field is an auto-find field. The DD findreq logic
657 // will use this. When it sees a changed autofind field, it knows that the autofind failed.
658 If (iState AND Operation_Mode=0) Begin
659 Move (Item_NoPut(self,iItem)=0 ) to bOk // if not noput, we are find
660 If not bOk begin
661 // If not put, then if field is autofind or autofind_ge and it is findReq we will allow the
662 // changed state to get set in the DD.
663 Get Data_file iItem to iFile
664 Get Data_field iItem to iField
665 Get Server to iServer
666 If (iServer and iFile) Begin
667 Get File_Field_Options of iServer iFile iField to iOpts
668 If ( ( (iOpts IAND DD_FINDREQ)=DD_FINDREQ) and ;
669 ( ( (iOpts IAND DD_AUTOFIND)=DD_AUTOFIND) or ((iOpts IAND DD_AUTOFIND_GE)=DD_AUTOFIND_GE) ) ) ;
670 Move true to bOk
671 end
672 end
673 if bOk Set Item_Field_Changed_State item iItem to iState
674 end
675 End_Procedure
676
677
678
679 //************************************************************************//
680 // Function Field_Field_Changed_State //
681 // Function Item_Field_Changed_State //
682 // Procedure Set Item_Field_Changed_State //
683 // Looks in the Data_Set for the passed file to see if the fieldvalue //
684 // has been changed. //
685 //************************************************************************//
686
687 { MethodType=Property Visibility=Private }
688 Function File_Field_Changed_State Integer iFile Integer iField Returns Integer
689 Integer iDSO
690 Get Server to iDSO
691 If (iDSO AND iFile) ;
692 Function_Return (File_Field_Changed_State(iDSO, iFile, iField))
693 End_Function
694
695 { MethodType=Property Visibility=Private }
696 Function Item_Field_Changed_State Integer iItem Returns Integer
697 Integer iResult
698 Get Item_Field_Property GET_File_Field_Changed_State iItem to iResult
699 Function_Return iResult
700 End_Function
701
702 { MethodType=Property Visibility=Private }
703 Procedure Set Item_Field_Changed_State Integer iItem Integer iState
704 Integer iFile iField
705 Integer iServer
706 Get Data_File Item iItem to iFile
707 Get Data_Field Item iItem to iField
708 Get Server to iServer
709 If (iFile AND iServer) ;
710 Set File_Field_Changed_State of iServer iFile iField to iState
711 End_Procedure // Set Item_Field_Changed_State
712
713
714
715
716 //************************************************************************//
717 // Procedure Copy_Item_Options //
718 // This procedure will copy the Item_Option which have been defined in //
719 // a Data_Set to the item defined in this object. It is passed the //
720 // DSO, Filed#, DEO and Item#. Eventually we can change server.pkg //
721 // to send this message saving a redundant evaluation of these //
722 // parameters. This is a time critical operation. //
723 //************************************************************************//
724
725
726 Define DD_DEO_MASK for (DD_NOENTER ior DD_SKIPFOUND ior DD_CAPSLOCK ior DD_ZERO_SUPPRESS ior DD_AUTORETURN ior DD_AUTOBACK ior DD_AUTOCLEAR)
727
728 { Visibility=Private }
729 Procedure Copy_Item_Options Integer iDSO Integer iFile Integer iField ;
730 Integer iDEO Integer iItem
731 Integer iDEO_Opt
732 Integer iDSO_Opt
733
734 If not (Extended_deo_State(Self)) ;
735 Procedure_Return
736
737 Get File_Field_Options of iDSO iFile iField to iDSO_Opt
738 // we don't want to allow all DDO options. The mask contains the
739 // bits that are legal
740 Move (iDSO_Opt iand DD_DEO_MASK) to iDSO_Opt
741 Get Item_Options of iDEO item iItem to iDEO_Opt
742 Set Item_Options of iDEO item iItem to (iDEO_Opt ior iDSO_Opt)
743
744//#IFDEF IS$WINDOWS
745 Set Form_Options of iDEO item iItem to (iDEO_Opt ior iDSO_Opt)
746//#ENDIF
747
748 If (iDSO_Opt iand DD_AUTOCLEAR) ;
749 Set Autoclear_State of iDEO item iItem to True
750 Send Copy_Mask_Options iDSO iFile iField iDEO iItem
751
752 // If we should assign label from DD send message to do so.
753 If (Auto_Label_State(Self)) Begin
754 Send Assign_DD_Label iDSO iFile iField iDEO iItem
755 End
756
757 // Assign the tooltip according to the DDO's Status_Help string....
758 Send SetToolTipFromStatusHelp
759 End_Procedure // Copy_Item_Options
760
761
762 // This is a stub. This is augmented when a class imports Extended_DEO_Status_Help_Mixin. This means that Extended_DEO_Status_Help_Mixin
763 // must be imported 'after' this mixin class (Extended_DEO_Mixin).
764 { Visibility=Private }
765 Procedure SetToolTipFromStatusHelp
766 // Do nothing. This is augmented in Extended_DEO_Status_Help_Mixin
767 End_Procedure // SetToolTipFromStatusHelp
768
769
770 // return the autofind mode for the current item.
771 // 0 = no autofind, 1 = autofind, 2 = autofind_ge
772 //
773 { MethodType=Property Visibility=Private }
774 Function AutoFindMode integer iItem returns integer
775 Integer iServer iFile iField iOpts bOn
776
777 // If the item option is set, use it. Normally this option will NOT
778 // be set if you are using DDOs.
779 get item_option iItem AUTOFIND_BIT to bOn
780 if bOn begin
781 get item_option iItem AUTOFIND_GE_BIT to bOn
782 Function_return (if(bOn,2,1))
783 end
784
785 // if no item option and we are using DDOs check the DDO to see if the
786 // field has an associated autofind setting
787 If (Extended_Deo_State(self)) Begin
788 Get Data_file iItem to iFile
789 Get Data_field iItem to iField
790 Get Server to iServer
791 If (iServer and iFile) Begin
792 Get File_Field_Options of iServer iFile iField to iOpts
793 If ((iOpts iAND DD_AUTOFIND_GE)=DD_AUTOFIND_GE) function_return 2
794 else if ((iOpts iAND DD_AUTOFIND)=DD_AUTOFIND) Function_return 1
795 end
796 end
797 Function_Return 0
798 end_function
799
800 // changes to improve autofind logic.
801 //
802 { Visibility=Private }
803 procedure DoAutoFind
804 Integer bChanged eAuto iCur
805 Get Current_item to iCur
806 // both changed_state and item_changed_state must be set for an autofind. If a default
807 // value is set item_changed_state will be true and changed_state will be false. We want to
808 // ignore these conditions
809 get item_changed_State iCur to bChanged
810 if (bChanged) begin // and changed_state(self)) begin
811 get AutoFindMode iCur to eAuto
812 if (eAuto<>0) ;
813 Send entry_autofind (if(eAuto=2,GE,EQ)) iCur
814 end
815 end_procedure
816
817
818 //************************************************************************//
819 // Procedure Copy_Mask_Options //
820 // This procedure copies any mask inforamtion. Right now only windows //
821 // uses this. If the window is not already set to a mask type it checks //
822 // the DD for a type. If one exists it sets the type, the mask_value_type //
823 // (should it return masked values) and a mask. If numeric or currency //
824 // and the mask is empty it creates a default mask. //
825 //************************************************************************//
826
827//#IFDEF IS$WINDOWS
828
829 //
830 // Windows mask support version
831 //
832 { Visibility=Private }
833 Procedure Copy_Mask_Options Integer iDSO Integer iFile Integer iField ;
834 Integer iDEO Integer iItem
835 Integer iDEOOpts
836 Integer iMaskType iMaskValState iFieldType iFormType
837 String sMask
838
839 // if mask type not manually set already. If mask-type is already assigned we assume
840 // that both the mask and the type has been set and we will not change it.
841 Get Form_Datatype iItem to iFormType // the datatype of the object/item
842 If (iFormType<=ASCII_WINDOW) Begin
843 Get_Attribute DF_FIELD_TYPE of iFile iField to iFieldType // the type of the column
844 Get File_Field_Mask_Type of iDSO iFile iField to iMaskType // the type specified in the DD
845
846 // 12.1: if a datetime, the unassigned default is ascii_window. If this is a datetime
847 // and there is no DD masktype, we assume the DEO has done nothing with this.
848 // We will set this to DateTime as this works better for data entry
849 If (iFormType=Ascii_Window and iFieldType=DF_DATETIME and iMaskType=0) Begin
850 Move Mask_Datetime_Window to iMaskType
851 End
852
853 // if a mask is already defined in the DEO we will use that mask instead of
854 // the one in the DD. We assume the developer knew what they were doing to
855 // go to the extra trouble of creating a deo mask, yet no mask data-type.
856 Get Form_Mask item iItem to sMask // first see if we have local mask
857 If sMask eq '' ; // only get DD mask if DEO mask is unassigned.
858 Get File_Field_Mask of iDSO iFile iField to sMask // Get the mask for this
859 // if we have no type but we've got a mask - auto-assign it
860 If (iMaskType=0 AND sMask<>"") Begin
861 If (iFieldType=DF_DATE) ;
862 Move Mask_Date_Window to iMaskType
863 If (iFieldType=DF_DATETIME) ;
864 Move Mask_Datetime_Window to iMaskType
865 Else If (iFieldType=DF_BCD) ;
866 Move Mask_Numeric_Window to iMaskType
867 Else ;
868 Move Mask_Window to iMaskType
869 End
870
871 If iMaskType gt ASCII_WINDOW Begin // if field mask type is set
872 Set Form_DataType item iItem to iMaskType // set mask type from ddo (might also set form mask)
873 // if the mask is blank but the field type is numeric or currency
874 // we will build an automatic mask based on our default mask
875 If (iMaskType=MASK_NUMERIC_WINDOW OR iMaskType=MASK_CURRENCY_WINDOW) Begin
876 If (sMask='') Begin
877 Get Field_Number_Default_Mask iFile iField ;
878 (if(iMaskType=Mask_Numeric_Window, Default_Numeric_Mask, Default_Currency_Mask)) to sMask
879 end
880 end
881 If sMask ne '' Begin
882 Set Form_Mask item iItem to sMask
883 // If we have a mask we must determine if the DEOs value should
884 // contain masking characters or not. This would probably only be
885 // used with strings.
886 Get File_Field_Mask_Value_State of iDSO iFile iField to iMaskValState
887 //Set Form_Mask_Value_State item iItem to iMaskValState
888 end
889 end
890 // Now see if this item has a zero suppress set either by the DEO or (more likely) by
891 // the DDO. If zero-suppress add a "Z" to first char of mask only if Z is not already there.
892 Get Item_Options of iDEO iItem to iDEOOpts
893 If (iDEOOpts IAND DD_ZERO_SUPPRESS) Begin
894 Get Form_Mask item iItem to sMask // don't assume we know what sMask is.
895 If ( (sMask<>"") AND (Left(sMask,1)<>"Z") ) ;
896 Set Form_mask iItem to ("Z"+sMask)
897 End
898 End
899 End_Procedure
900
901 //************************************************************************//
902 // Assign_DD_Label //
903 // This assigns the DEO's from the DD. By default, this uses the //
904 // standard long label name and assigns the Label property. If you want //
905 // to assign short labels or header_labels you must augment or replace //
906 // this (which dblist and dbgrid do). //
907 //************************************************************************//
908
909 { Visibility=Private }
910 Procedure Assign_DD_Label Integer iDSO Integer iFile Integer iField ;
911 Integer iDEO Integer iItem
912 string sName
913 Get File_Field_Label of iDSO iFile iField DD_LABEL_LONG to sName
914 Set Label to sName
915 End_Procedure
916
917
918//#ELSE
919
920// // Character mode version - currently does nothing.
921// Procedure Copy_Mask_Options Integer iDSO Integer iFile Integer iField ;
922// Integer iDEO Integer iItem
923// End_Procedure
924
925// // Character mode version - currently does nothing.
926// Procedure Assign_DD_Label Integer iDSO Integer iFile Integer iField ;
927// Integer iDEO Integer iItem
928// End_Procedure
929
930//#ENDIF
931
932
933 //************************************************************************//
934 // It is important that a DEO only needs to communicate with its //
935 // server. It should not have to find its watched servers. This means that//
936 // requests for item (field) messages to the DSO must ask for the FILE and//
937 // the field. I have restored the DSS_ message to support this but am now //
938 // calling it exec_file_field_MSG. //
939 //************************************************************************//
940
941
942 //************************************************************************//
943 // Function Exec_Field_Message //
944 // This function will be called after an Item_Entry, Item_Exit or //
945 // Item_Validate function has been executed. If the item is field-based //
946 // and this object has a server, it will request this server to execute //
947 // the field message for this field. //
948 //************************************************************************//
949
950 { Visibility=Private }
951 Function Exec_Field_Message Integer iItem Integer iMsg Returns Integer
952 Integer iFile
953 Integer iField
954 Integer iDSO
955 Integer iResult
956 Get Server to iDSO
957 If iDSO Begin
958 Get Data_File item iItem to iFile
959 If iFile Begin
960 Get Data_Field item iItem to iField
961 Get Exec_File_Field_Message of iDSO iFile iField iMsg to iResult
962 Function_Return iResult
963 End
964 End
965 End_Function
966
967
968
969 //************************************************************************//
970 // Function Item_Entry //
971 //************************************************************************//
972
973 { MethodType=Event Visibility=Private }
974 Function Item_Entry Integer iMsg Integer iItem Returns Integer
975 Integer iResult
976 If Not (Object_Item_Entry_Exit(self)) ;
977 Function_Return
978 If iMsg ;
979 Get iMsg item iItem to iResult
980 If (Not(iResult) AND Extended_Deo_State(self)) ;
981 Get Exec_Field_Message iItem GET_Field_Entry_MSG to iResult
982 Function_Return iResult
983 End_Function
984
985
986
987 //************************************************************************//
988 // Function Item_Exit //
989 //************************************************************************//
990
991 { MethodType=Event Visibility=Private }
992 Function Item_Exit Integer iMsg Integer iItem Returns Integer
993 Integer iResult
994 If Not (Object_Item_Entry_Exit(self)) ;
995 Function_Return
996 If iMsg ;
997 Get iMsg item iItem to iResult
998 If (Not(iResult) AND Extended_Deo_State(self)) ;
999 Get Exec_Field_Message iItem GET_Field_Exit_MSG to iResult
1000 Function_Return iResult
1001 End_Function
1002
1003
1004
1005 //************************************************************************//
1006 // Function Item_Validate //
1007 //************************************************************************//
1008
1009 { MethodType=Event Visibility=Private }
1010 Function Item_Validate Integer iMsg Integer iItem Returns Integer
1011 Integer iFile
1012 Integer iField
1013 Integer iResult
1014 Integer iDSO
1015 // if it is really shadowed we want to skip it. It may be hidden (in a tab page - vdf7 change). If so,
1016 // it will be marked as implicitly hidden and shadowed. If it is, we still may want this
1017 If (not(Implicit_hidden_state(self)) AND Shadow_state(self,iItem)) ;
1018 Function_Return 0
1019 If iMsg ;
1020 Get iMsg item iItem to iResult
1021 If (Not(iResult) AND Extended_Deo_State(self)) Begin
1022 Get Server to iDSO
1023 If iDSO Begin
1024 Get Data_File item iItem to iFile
1025 If iFile Begin
1026 Get Data_Field item iItem to iField
1027 Get File_Field_Validate_Field of iDSO iFile iField to iResult
1028 End
1029 End
1030 End
1031 Function_Return iResult
1032 End_Function
1033
1034
1035
1036 //************************************************************************//
1037 // Functions Prompt_Object and Zoom_Object //
1038 // These function have been augmented to supply a Fieldbased Prompt- or //
1039 // Zoom-object when no object has been defined locally. //
1040 //************************************************************************//
1041
1042 { MethodType=Property Visibility=Private }
1043 Function Prompt_Object Integer iItem Returns Integer
1044 Integer iObj
1045 // this is standard get prompt logic
1046 Forward Get Prompt_Object item iItem to iObj
1047 If (iObj=0 AND Extended_DEO_State(self)) begin
1048 Get Item_Field_Property GET_File_Field_Prompt_Object iItem to iObj
1049 // checks to see if the checkbox is assigned to a validation table prompt. If it
1050 // is suppress it, it provides no useful information
1051 If (iObj=DD_Global_Validation_Prompt_Object and checkbox_item_state(self,iItem)) ;
1052 move 0 to iObj
1053 end
1054 Function_Return iObj
1055 End_Function
1056
1057 { MethodType=Property Visibility=Private }
1058 Function Zoom_Object Integer iItem Returns Integer
1059 Integer iObj
1060 Forward Get Zoom_Object item iItem to iObj
1061 If (iObj=0 AND Extended_DEO_State(self)) ;
1062 Get Item_Field_Property GET_File_Field_Zoom_Object iItem to iObj
1063 Function_Return iObj
1064 End_Function
1065
1066
1067
1068 //************************************************************************//
1069 // //
1070 // Methods to set and get the value of a field. When set all DSOs and DEOs//
1071 // are notified. //
1072 // Get/Set File_Field_Current_Value - must pass file and field number //
1073 // Get/Set Item_Field_Current_Value - uses file and Field of passed item //
1074 //************************************************************************//
1075
1076 { MethodType=Property Visibility=Private }
1077 Procedure Set File_Field_Current_Value Integer iFile Integer iField String sValue
1078 Integer iServer
1079 Get Server to iServer
1080 If (iServer AND iFile) ;
1081 Set File_Field_Current_Value of iServer iFile iField to sValue
1082 End_Procedure // Set File_Field_Current_Value
1083
1084 { MethodType=Property Visibility=Private }
1085 Function File_Field_Current_Value Integer iFile Integer iField returns string
1086 Integer iServer
1087 string sValue
1088 Get Server to iServer
1089 If (iServer AND iFile);
1090 Get File_Field_Current_Value of iServer iFile iField to sValue
1091 Function_Return sValue
1092 End_Function // File_Field_Current_Value
1093
1094 { MethodType=Property Visibility=Private }
1095 Procedure Set Item_Field_Current_Value Integer iItem String sValue
1096 Integer iFile iField
1097 //showln "item-field-cur-val " iitem ' ' sValue
1098 Get Data_File Item iItem to iFile
1099 Get Data_Field Item iItem to iField
1100 Set File_Field_Current_Value iFile iField to sValue
1101 End_Procedure // Set Item_Field_Current_Value
1102
1103 { MethodType=Property Visibility=Private }
1104 Function Item_Field_Current_Value Integer iItem Returns String
1105 Integer iFile iField
1106 Get Data_File Item iItem to iFile
1107 Get Data_Field Item iItem to iField
1108 Function_Return (File_Field_Current_Value(self,iFile,iField))
1109 End_Function // Item_Field_Current_Value
1110
1111 //************************************************************************//
1112 // //
1113 // Augment Entry_Update to not update from the object during a save. The //
1114 // extended data-sets should take care of that. Just in case, we support //
1115 // a property, Allow_save_entry_update to override this. //
1116 //************************************************************************//
1117 { Visibility=Private }
1118 Procedure Entry_Update Integer iFile Integer iAll
1119 If ( Extended_DEO_State(self)=0 OR ;
1120 Operation_Mode<>MODE_SAVING OR iAll<>3 OR ;
1121 Allow_Save_Entry_Update(self) ) ; //3=dso save
1122 Forward Send Entry_Update iFile iAll
1123 End_Procedure
1124
1125 //************************************************************************//
1126 // Procedure Entry_Display //
1127 // Augmented to handle checkbox items. If an item is a checkbox it will //
1128 // check if the item is True or False and set select_state. //
1129 // Note that we disable entry_refresh_state of both this object and //
1130 // the focus object //
1131 // //
1132 //************************************************************************//
1133 { Visibility=Private }
1134 Procedure Entry_Display Integer iFile Integer iFlag
1135 integer iState
1136 integer iCount iBase iLimit iItems
1137 integer iOldState
1138 integer iDFile
1139 integer iOldFocSt
1140 integer iFoc
1141 integer iIsExt
1142 Get Entry_Refresh_State to iOldState
1143 Set Entry_Refresh_State to True
1144 Get Focus of Desktop to iFoc
1145 If iFoc ne self ;
1146 Get Extended_DEO_State of iFoc to iIsExt // if focus is deo item
1147 If iIsExt Begin // disable the state so
1148 Get Entry_Refresh_State of iFoc to iOldFocSt // value will come
1149 Set Entry_Refresh_State of iFoc to True // from Local buffer.
1150 End
1151 Forward send Entry_Display iFile iFlag // do normal entdisplay
1152 If iIsExt ;
1153 Set Entry_Refresh_State of iFoc to iOldFocSt
1154 Set Entry_Refresh_State to iOldState
1155
1156 If Not (Extended_Deo_State(self)) ;
1157 Procedure_Return
1158
1159 Get Item_Count to iItems // items in object
1160 Get Base_item to iBase // Item# of col 0 of current row
1161 Get Item_Limit to iLimit // # items in a row
1162 If iLimit eq 0 ; // if no rows use item-count
1163 Move iItems to iLimit
1164 Add (iBase-1) to iLimit // Item# of last col of current row
1165 If iItems GT iLimit Begin
1166 For iCount from iBase to iLimit
1167 If (checkbox_Item_State(self,iCount)) Begin
1168 // We will set the value based on the following:
1169 // We have a data_file for the DEO item AND
1170 // (1st param is 0 and data-file is in done array OR
1171 // DataFile=1st param OR flag says JUST DO IT.
1172 //
1173 // With DSO we expect this to be called with 0 0 which
1174 // means, dispay if data-file is in done array!
1175 Get Data_File item iCount to iDFile
1176 if iDFile eq 0 indicate found FALSE // no data-file, no action
1177 else if iFile eq 0 is_file_included iDFile 1 // Sets FOUND if in done array
1178 else indicate found as (iDFile = iFile OR iFlag = TRUE)
1179 [Found] Begin
1180 // note: gets sel-state based on file-buffer not on dd buffer
1181 Get Item_Buffer_Select_State iCount to iState
1182 Set Local_Select_State item iCount to iState
1183 //Forward Set Select_State item iCount to iState
1184 End
1185 End
1186 Loop
1187 End
1188 end_procedure
1189
1190 //************************************************************************//
1191 // Procedure Entry_Clear //
1192 // Augmented to handle DDs. //
1193 // Note that we disable entry_refresh_state of both this object and //
1194 // the focus object //
1195 //************************************************************************//
1196 { Visibility=Private }
1197 Procedure Entry_Clear Integer Fg
1198 integer iOldState
1199 integer iOldFocSt
1200 integer iFoc
1201 integer iIsExt
1202 Get Entry_Refresh_State to iOldState
1203 Set Entry_Refresh_State to True
1204 Get Focus of Desktop to iFoc
1205 If iFoc ne self ;
1206 Get Extended_DEO_State of iFoc to iIsExt // if focus is deo item
1207 If iIsExt Begin // disable the state so
1208 Get Entry_Refresh_State of iFoc to iOldFocSt // value will come
1209 Set Entry_Refresh_State of iFoc to True // from Local buffer.
1210 End
1211 Forward Send Entry_Clear Fg
1212 If iIsExt ;
1213 Set Entry_Refresh_State of iFoc to iOldFocSt
1214 Set Entry_Refresh_State to iOldState
1215 End_Procedure // Entry_Clear
1216
1217 //************************************************************************//
1218 // Procedure Set CheckBox_Item //
1219 // With extended DEOs we only care about the first paramter. This is the //
1220 // display value (more of a label really). This does set all the required //
1221 // proeprties to support checkbox items. True/false values are obtained //
1222 // from the DSO. //
1223 //************************************************************************//
1224 //
1225 { NoDoc=True }
1226 Procedure Set CheckBox_Item String ItemVal String TrueVal String FalseVal
1227 Integer iItem
1228 Integer iObj
1229
1230 If Not (Extended_Deo_State(self)) Begin
1231 If Num_Arguments eq 1 ; // allow 1 or 3 args for
1232 Forward Set CheckBox_Item to ItemVal // backwards compatibility.
1233 else ;
1234 Forward Set CheckBox_Item to ItemVal TrueVal FalseVal
1235 Procedure_Return
1236 End
1237
1238 // This is the object that has the items. With tables it is the proto-
1239 // type row, with forms it is itself. This allows table and form support
1240 Get ProtoType_Object to iObj
1241 Get Current_Item of iObj to iItem
1242 Set entry_state of iObj item iItem to False
1243 Set checkbox_item_State of iObj item iItem to True
1244 Set Value of iObj item iItem to ItemVal
1245 End_Procedure
1246
1247 //************************************************************************//
1248 // Procedure Set CheckBox_Label //
1249 // With extended DEOs we only care about the first paramter. This is the //
1250 // display value (more of a label really). This does set all the required //
1251 // proeprties to support checkbox items. True/false values are obtained //
1252 // from the DSO. //
1253 //************************************************************************//
1254
1255 { MethodType=Property Nodoc=True }
1256 { DesignTime=False }
1257 Procedure Set CheckBox_Label String ItemVal
1258 Integer iItem
1259 Integer iObj
1260
1261 // This is the object that has the items. With tables it is the proto-
1262 // type row, with forms it is itself. This allows table and form support
1263 Get ProtoType_Object to iObj
1264 Get Current_Item of iObj to iItem
1265 Set entry_state of iObj item iItem to False
1266 Set checkbox_item_State of iObj item iItem to True
1267 Set Value of iObj item iItem to ItemVal
1268 End_Procedure
1269
1270
1271 //************************************************************************//
1272 // Procedure Set Select_State //
1273 // This procedure is used to trap a change of the value of this item //
1274 // by user input or by a programmers' action. It will call Item_Field_ //
1275 // Value to notify the Data_Set of the value changes. Note that it will //
1276 // only notify the Data_Set when there is a change in value. //
1277 // //
1278 //************************************************************************//
1279
1280 { MethodType=Property NoDoc=True }
1281 Procedure Set Select_State Integer iItem Integer iState
1282
1283 If Not (Extended_Deo_State(self)) Begin
1284 Forward Set Select_State item iItem to iState
1285 Procedure_Return
1286 End
1287
1288 If Not (CheckBox_item_State(self,iItem)) Procedure_Return
1289 // We only need to update the DSO if the data-set itself is not responsible
1290 // for calling this message. DSOs will only do when their operation_mode is
1291 // non-zero. Also if there is no change, there is no need to notify the DSO
1292 If ( (Operation_mode=0) AND ;
1293 (Entry_Refresh_State(self)=0) AND ;
1294 (Select_State(self,iItem)<>iState) AND ;
1295 (Data_File(self,iItem)) AND ;
1296 (Item_NoPut(self,iItem)=0) ) Begin
1297 // DF passes a third state named Toggle_state. If passed to the
1298 // work to toggle it and proceed on.
1299 If iState eq TOGGLE_STATE ;
1300 Move (Not(Select_State(self,iItem))) to iState
1301 Set Item_Field_Select_State iItem to iState // indirectly update the value
1302 End
1303 Else ;
1304 Set Local_Select_state iItem to iState
1305 End_Procedure // Set Select_State
1306
1307 //************************************************************************//
1308 // Get/Set File_field_select_State //
1309 // Get/Set Item_field_select_State //
1310 // These direct to the DSO as required. They either set the DSO buffer //
1311 // value based on select_state or they return the current state of this //
1312 // field. //
1313 // //
1314 //************************************************************************//
1315
1316 { MethodType=Property Visibility=Private }
1317 Function File_Field_Select_State Integer iFile integer iField returns integer
1318 Integer iServer
1319 Get Server to iServer
1320 If (iServer AND iFile AND iField) ;
1321 Function_Return (File_Field_Select_State(iServer,iFile,iField))
1322 End_Function // File_Field_Select_State
1323
1324 { MethodType=Property Visibility=Private }
1325 Procedure Set File_Field_Select_State Integer iFile Integer iField Integer iState
1326 Integer iServer
1327 Get Server to iServer
1328 If (iServer AND iFile AND iField) ;
1329 Set File_Field_Select_State of iServer iFile iField to iState
1330 End_Procedure // Set File_Field_Select_State
1331
1332 { MethodType=Property Visibility=Private }
1333 Function Item_Field_Select_State Integer iItem returns integer
1334 Integer iFile iField
1335 Get Data_File Item iItem to iFile
1336 Get Data_Field Item iItem to iField
1337 Function_Return (File_Field_Select_State(self,iFile,iField))
1338 End_Function // Item_Field_Select_State
1339
1340 { MethodType=Property Visibility=Private }
1341 Procedure Set Item_Field_Select_State Integer iItem String iState
1342 Integer iFile iField
1343 Get Data_File Item iItem to iFile
1344 Get Data_Field Item iItem to iField
1345 Set File_Field_Select_State iFile iField to iState
1346 End_Procedure // Set Item_Field_Select_State
1347
1348
1349 //************************************************************************//
1350 // Get Item_Buffer_Select_State //
1351 // Returns Select_state based on field's buffer value (not the DD buffer //
1352 // value). Used by entry_display which must use the real buffer value. //
1353 //************************************************************************//
1354
1355 { MethodType=Property Visibility=Private }
1356 Function Item_Buffer_Select_State Integer iItem returns integer
1357 Integer iFile iField
1358 Integer iServer
1359 Integer iRetVal
1360 String sValue
1361 Get Data_File Item iItem to iFile
1362 Get Data_Field Item iItem to iField
1363 Get Server to iServer
1364 If (iServer AND iFile AND iField) Begin
1365 Get_Field_Value iFile iField to sValue // command gets from buffer
1366 Function_Return (File_Field_Value_Select_State(iServer,iFile,iField,sValue))
1367 end
1368 Else ;
1369 Function_Return iRetVal
1370 End_Function // File_Field_Select_State
1371
1372 //
1373 // Notify DEO that a field option has changed. Deal with this however you want. Some
1374 // items are not set in options (see DD_DEO_MASK). For those we do nothing. Some options
1375 // can be handled dynamically by the deo.
1376 //
1377 { Visibility=Private }
1378 Procedure File_Field_Option_Changed integer iFile integer iField integer iOptions integer bClear
1379 handle hoDeo
1380 integer iOpts
1381 string sMask
1382 integer i iItems
1383 // Mask out the bits we don't care about.
1384 Move (iOptions IAND DD_DEO_MASK) to iOptions
1385 If (iOptions=0) procedure_return
1386 get prototype_object to hoDeo
1387 get Item_count of hoDEO to iItems
1388 For i from 0 to (iItems-1)
1389 If (Data_File(hoDeo,i)=iFile AND Data_Field(hoDeo,i)=iField) Begin
1390 Get Item_Options of hoDeo i to iOpts
1391 If (bClear) ;
1392 Move (iOpts - (iOpts IAND iOptions)) to iOpts
1393 else ;
1394 Move (iOpts IOR iOptions) to iOpts
1395 Set Item_Options of hoDEO i to iOpts
1396//#IFDEF IS$WINDOWS
1397 Set Form_Options of hoDEO i to iOpts
1398 // if zero suppress changed, we may need to change the
1399 // form mask.
1400 If (iOptions IAND DD_ZERO_SUPPRESS) Begin
1401 Get Form_Mask i to sMask
1402 If (sMask<>"") begin
1403 If (bClear AND left(sMask,1)="Z") begin // if clear and first character
1404 Set Form_Mask i to (remove(sMask,1,1)) // is Z remove it.
1405 send Item_Mask_Changed i
1406 end
1407 else If (bClear=0 AND left(sMask,1)<>"Z") begin // if set and first char
1408 Set Form_Mask i to ("Z"+sMask) // is not a Z add it.
1409 send Item_Mask_Changed i
1410 end
1411 end
1412 end
1413//#ENDIF
1414 Send Item_Options_Changed i // notify multi-row DEOs that the prototype has changed
1415 End
1416 Loop
1417 end_procedure
1418
1419 // used to notify columns in a multi row object that options have changed. (See Dftable.pkg
1420 // for replacment of this method). Single item objects don't need to do anything
1421 { Visibility=Private }
1422 Procedure Item_Options_Changed integer iItem
1423 end_procedure
1424
1425//#IFDEF IS$WINDOWS
1426 // DD mask has changed. Update DEOs as needed
1427 //
1428 { Visibility=Private }
1429 Procedure File_Field_mask_Changed integer iFile integer iField string sMask
1430 handle hDeo
1431 integer iBits bZero
1432 integer i iItems
1433 get prototype_object to hDeo
1434 get Item_count of hDEO to iItems
1435 For i from 0 to (iItems-1)
1436 If (Data_File(hDeo,i)=iFile and Data_field(hDEO,i)=iField) begin
1437 Get File_field_Mask of (server(self)) iFile iField to sMask
1438 If (sMask<>"") Begin
1439 Get item_Options of hDeo i to iBits
1440 Move (iBits IAND DD_ZERO_SUPPRESS) to bZero
1441 if (bZero AND left(sMask,1)<>"Z") Move ("Z"+sMask) to sMask
1442 End
1443 Set form_mask i to sMask
1444 send Item_Mask_Changed i
1445 End
1446 Loop
1447 end_procedure
1448
1449 // DD label has changed. If auto_label_state is T, then update any required labels
1450 //
1451 { Visibility=Private }
1452 Procedure File_Field_Label_Changed integer iFile integer iField boolean bLong string sLabel
1453 handle hDeo
1454 integer i iItems
1455 If (Auto_Label_State(self)) Begin
1456 get prototype_object to hDeo
1457 get Item_count of hDEO to iItems
1458 For i from 0 to (iItems-1)
1459 If (Data_File(hDeo,i)=iFile and Data_field(hDEO,i)=iField) begin
1460 Send Assign_DD_Label (Server(self)) iFile iField hDeo i
1461 End
1462 Loop
1463 end
1464 End_Procedure
1465
1466 // used to notify columns in a multi row object that a mask has changed. (See Dftable.pkg
1467 // for replacment of this method). Single item objects don't need to do anything
1468 //
1469 { Visibility=Private }
1470 Procedure Item_Mask_Changed integer iItem
1471 end_procedure
1472
1473//#ELSE
1474
1475// Procedure File_Field_mask_Changed integer iFile integer iField string sMask
1476// end_procedure
1477
1478// Procedure File_Field_Label_Changed integer iFile integer iField boolean bLong string sLabel
1479// End_procedure
1480
1481//#ENDIF
1482
1483 { Visibility=Private }
1484 Procedure Attach_Deo_To_Server
1485 Integer iSrvr
1486 Get Server to iSrvr
1487 If iSrvr ;
1488 Set Extended_DEO_State to (Extended_DSO_State(iSrvr))
1489 Forward Send Attach_deo_to_Server
1490 End_Procedure
1491
1492
1493 // Augmented to stop toggling if the item's checkbox_state is false
1494 //
1495 { Visibility=Private }
1496 Procedure Select_Toggling integer iItem Integer eState // actually supports: 0-false, 1-true, 2-toggle
1497
1498 If not (Extended_Deo_State(self)) Begin
1499 Forward Send Select_toggling iItem eState
1500 Procedure_Return
1501 End
1502
1503 // With DD based DEOs we only pay attention to select_toggling if
1504 // 1) Object is enabled, 2) the item is not shadowed, and 3) it is a checkbox item.
1505 // We check checkbox_state here, all other checks handled in forward.
1506 // This allows people to use entry_state in dbGrids as a way of making the item
1507 // non-editable but focusable.
1508 If (CheckBox_item_State(self,iItem)) ;
1509 Forward Send Select_toggling iItem eState
1510
1511 End_Procedure
1512
1513 // 12.1: Agument activate to handle skipfound. When a skipfound field is used with a prompt
1514 // the prompt attempts to send activate to the object that invoked it. If this is a skipfound item
1515 // can have various problems. If a record is found, the item will be skipfound and the deactivation
1516 // will not work (lock up). If it is not found but a record is in the buffer, skifound can mess up.
1517 // This works with single and multi item DEOs
1518 Procedure Activate Returns Integer
1519 Integer iErr iItem iCols iProtoItem iItems
1520 Boolean bSkip bShadow
1521 Handle hoProtoType
1522 // try to limit this checking only to activates that occur after a prompt. In such a case
1523 // the object will already be active, the focus is elsewhere but the scope_focus will be on
1524 // this object. In such a case, we assume that you were able to invoke this from an enabled object.
1525 If (Active_State(Self) and Focus(Self)<>Self and Scope_Focus(Self)=Self) Begin
1526 Get Prototype_Object to hoProtoType
1527 Get Current_Item to iItem
1528 Get Item_Count to iItems
1529 // I don't think this will ever fail but maybe an empty grid could do this
1530 If (iItem<iItems) Begin
1531 Get Item_Limit to iCols // items in row
1532 If (iCols<>0) Begin
1533 Move (Mod(iItem,iCols)) to iProtoItem
1534 End
1535 Else Begin
1536 Move iItem to iProtoItem
1537 End
1538 Get Item_Option of hoProtoType iProtoItem skipfound to bSkip
1539 Get Shadow_State iItem to bShadow
1540 // to be able to retake the focus, skipfound and shadow_state must be false
1541 If bSkip Begin
1542 Set Item_Option of hoProtoType iProtoItem skipfound to False
1543 End
1544 If bShadow Begin
1545 Set shadow_state iItem to False
1546 End
1547 End
1548 End
1549 Forward Get msg_activate to iErr
1550 // restore Skipfound and shadowstate
1551 If bSkip Begin
1552 Set Item_Option of hoProtoType iProtoItem skipfound to True
1553 End
1554 // setting skip to true, will set shadow to true. So we must reset it if
1555 // either shadow was true of skip is true (and therefore shadow was set)
1556 If (bShadow or bSkip) Begin
1557 Set shadow_state iItem to bShadow
1558 End
1559 // if this is supposed to be shadowed, move to the next item/object
1560 If (iErr=0 and bShadow) Begin
1561 Send Next
1562 End
1563 Function_Return iErr
1564 End_Procedure
1565
1566
1567End_Class
1568
1569//****************************************************************************//
1570// Mixin Class: Extended_DEO_Status_help_mixin //
1571// This is made seperate so that text edit objects can use this interface. //
1572// //
1573//****************************************************************************//
1574
1575Class Extended_Deo_Status_Help_Mixin is a mixin
1576
1577 //************************************************************************//
1578 // Function Status_Help //
1579 // returns help status field value from data-set. Note that the CM and //
1580 // GUI versions are different because GUI already understands this //
1581 // and CM does not (yet) //
1582 //************************************************************************//
1583
1584 { MethodType=Property Visibility=Private }
1585 Function Status_Help Integer iItem Returns String
1586 String sHelp
1587 Integer iDSO
1588 Integer iFile iField
1589 Integer iItm
1590 If Num_Arguments eq 0 ;
1591 Move 0 to iItm
1592 Else Move iItem to iItm
1593//#IFDEF IS$WINDOWS
1594 Forward Get Status_Help iItm to sHelp
1595//#ENDIF
1596
1597 If sHelp eq '' Begin
1598 Get Server to iDSO
1599 Get Data_File to iFile
1600 Get Data_Field to iField
1601 If (iDSO AND iFile AND Extended_DSO_State(iDSO)) ;
1602 Get File_Field_Status_Help of iDSO iFile iField to sHelp
1603 End
1604 Function_Return sHelp
1605 End_Function
1606
1607End_Class // Extended_Deo_Status_Help_Mixins
1608
1609
1610//****************************************************************************
1611// Mixin Class: Extended_DEO_Status_Help_Tooltip_Mixin
1612// Used by DFwin DEO objects that are single item. This supports initializing the psToolTip property
1613// to match the Status_Help as defined in the data dictionary of the Table.Column binded to this control.
1614//
1615// To use this mixin, the class must import ToolTip_Support_Mixin and Extended_DEO_Statu_Help_Mixin.
1616// The mixin define methods for these two classes must be called first (before this class's define method).
1617//****************************************************************************
1618
1619Class Extended_DEO_Status_Help_Tooltip_Mixin is a mixin
1620
1621 // Set the psToolTip property to the Status_Help value.
1622 { Visibility=Private }
1623 Procedure SetToolTipFromStatusHelp
1624 String sStatusHelp sToolTip
1625 Integer eDelegationMode
1626 Boolean bUseDDOStatusHelp
1627
1628 If (ghoToolTipController = 0) Begin
1629 Procedure_Return
1630 End
1631
1632 Get pbUseDDOStatusHelp of ghoToolTipController to bUseDDOStatusHelp
1633
1634 If (bUseDDOStatusHelp) Begin
1635 // Initialize the tooltip to the Status_Help value (if it exists)....
1636 Get psToolTip to sToolTip
1637
1638 If (Trim(sToolTip) = "") Begin // only change the tooltip if it is not already set
1639 Get Delegation_Mode to eDelegationMode
1640 Set Delegation_Mode to No_Delegate_Or_Error
1641 Get Status_Help to sStatusHelp
1642 Move (Trim(sStatusHelp)) to sStatusHelp
1643
1644 If (sStatusHelp <> "") Begin
1645 Set psToolTip to sStatusHelp
1646 End
1647
1648 Set Delegation_Mode to eDelegationMode
1649 End
1650 End
1651 End_Procedure // SetToolTipFromStatusHelp
1652End_Class // Extended_DEO_Status_Help_Tooltip_Mixin
1653
1654
1655
1656//#IFDEF IS$WINDOWS // Extra mixin classes required for windows
1657
1658//****************************************************************************//
1659// Mixin Class: Extended_DEO_Single_Item_Mixin //
1660// Used by DFwin DEO objects that are single item. This lets us set some //
1661// required values for like background colors of displayonly and prompt //
1662// Buttons //
1663// //
1664//****************************************************************************//
1665
1666Class Extended_DEO_Prompt_Mixin is a mixin
1667
1668 //************************************************************************//
1669 // Procedure Scan_Servers //
1670 // Use this to set prompt buttons //
1671 //************************************************************************//
1672
1673 { Visibility=Private }
1674 Procedure Scan_Servers
1675 Integer iMode
1676 Forward Send Scan_Servers
1677
1678 If not (Extended_DEO_State(Self)) ;
1679 Procedure_Return
1680
1681 Get Prompt_Button_Mode to iMode
1682 If iMode eq PB_PromptAuto ;
1683 Send Create_Prompt_Button iMode
1684 //If (Shadow_State(self,0) ) ;
1685 // Set Form_Style_NoEnter to True
1686 End_Procedure
1687
1688 // returns the table's status for the refresh event. A table can either be
1689 // cleared, found or not touched by the operation. This can only be called while
1690 // within Refresh. This was created to hide the private is_file_included command
1691 Function DDRefreshTableStatus Integer iTable Returns Integer
1692 Boolean bIncluded
1693 is_file_included iTable 1 to bIncluded // see if main file is in find done array
1694 If bIncluded Begin
1695 Function_Return ddrtsFound
1696 End
1697 is_file_included iTable 0 to bIncluded // see if main file is in clear done array
1698 If bIncluded Begin
1699 Function_Return ddrtsCleared
1700
1701 End
1702 Function_Return ddrtsNone
1703 End_Function
1704
1705End_Class // Extended_DEO_Prompt_Mixin
1706
1707
1708//#ENDIF
1709