Class: Extended_DEO_Mixin
************************************************************************//
Extended_DEO_Mixin //
This mixin-class contains all necessary methods to support Extended_ //
Data_Sets. //
//
************************************************************************//
************************************************************************//
Synchronization Logic for DEOs and DSOs //
//
Whenever a change is made in an item this value must be also changed //
in the Data-set local field buffer. Whenever the field buffer changes //
the DEO must get notified. In addition, any time item_change_state is //
set to TRUE the DSO must get notified. //
//
Character Mode: In character mode we will augment the ENTRY function //
to maintain this. This will work in all cases except //
for checkboxes which do not use this function. We also //
trap set select_state to handle this. In addition, if //
the developer directly does a set_value we will trap //
this and make sure that the DSO is updated. When the //
DSO is updated it changes its buffer and it notifies //
all affected DEOs about the data-change. This provides //
for a dependent item support. //
//
Windows: In windows we have no entry function. In fact there are//
times where there will be focus/event change at all at //
the end of an entry (the menus generate no Windows or //
DF focus messages. This means that the focus value may //
not be updated in the DSO. We solve this by augmenting //
GET_field_value in the DSO. If the file/field being //
retreived is the focus file/field we get the data from //
DEO and not the local DSO buffer. Any time the focus //
changes we update the DSO. The only time we may not be //
in synch. is the focus object. We adjust for this. We //
use the notify_focus_change message to update the //
field buffer. Also, in the DSO the buffers are aligned //
before an entry_update can occur (this was another //
hole). This is not an issue for checkbox items since //
set select_state is always sent and redirected to the //
DSO. //
************************************************************************//
Class Hierarchy:
cObjectMixinExtended_DEO_MixinClass Definition
Properties
IntegerAllow_Save_Entry_Update
IntegerAuto_Label_State
IntegerEntry_Refresh_State
IntegerExtended_DEO_State
Functions and Procedures
IntegerActivate()
12.1: Agument activate to handle skipfound. When a skipfound field is used with a prompt
the prompt attempts to send activate to the object that invoked it. If this is a skipfound item
can have various problems. If a record is found, the item will be skipfound and the deactivation
will not work (lock up). If it is not found but a record is in the buffer, skifound can mess up.
This works with single and multi item DEOs
Assign_DD_Label(Integer iDSO Integer iFile Integer iField Integer iDEO Integer iItem)
************************************************************************//
Assign_DD_Label //
This assigns the DEO's from the DD. By default, this uses the //
standard long label name and assigns the Label property. If you want //
to assign short labels or header_labels you must augment or replace //
this (which dblist and dbgrid do). //
************************************************************************//
Attach_Deo_To_Server()
#ELSE
Procedure File_Field_mask_Changed integer iFile integer iField string sMask
end_procedure
Procedure File_Field_Label_Changed integer iFile integer iField boolean bLong string sLabel
End_procedure
#ENDIF
integerAutoFindMode(integer iItem)
return the autofind mode for the current item.
0 = no autofind, 1 = autofind, 2 = autofind_ge
ColumnComboEntryDefaults(integer iItem integer iFile integer iField)
************************************************************************//
Procedure Entry_Defaults //
This procedure will be called automatically after a clear operation on //
this DEO. We do not need to set the Change_Disabled_State because this //
is already been done for us. //
************************************************************************//
this is needed by combos in grids and will be augmented in a sub-class to do stuff
Copy_Item_Options(Integer iDSO Integer iFile Integer iField Integer iDEO Integer iItem)
Copy_Mask_Options(Integer iDSO Integer iFile Integer iField Integer iDEO Integer iItem)
************************************************************************//
Procedure Copy_Mask_Options //
This procedure copies any mask inforamtion. Right now only windows //
uses this. If the window is not already set to a mask type it checks //
the DD for a type. If one exists it sets the type, the mask_value_type //
(should it return masked values) and a mask. If numeric or currency //
and the mask is empty it creates a default mask. //
************************************************************************//
#IFDEF IS$WINDOWS
Windows mask support version
StringData_Value(Integer iItem)
************************************************************************//
Procedure Data_Value //
Return the value of this item's data. In this case it _is_ the item's //
value. This can be used to logically seperate display data and disk //
data. Combos use this. This is called by the xdataset class. //
************************************************************************//
Define_Extended_DEO_Mixin()
************************************************************************//
Procedure Define_Extended_DEO_Mixin //
This must be called upon creation of a DEO object to create and //
initialize some properties. This is called by Server.pkg mixin //
************************************************************************//
DoAutoFind()
changes to improve autofind logic.
Entry_Clear(Integer Fg)
************************************************************************//
Procedure Entry_Clear //
Augmented to handle DDs. //
Note that we disable entry_refresh_state of both this object and //
the focus object //
************************************************************************//
Entry_Defaults()
Entry_Display(Integer iFile Integer iFlag)
************************************************************************//
Procedure Entry_Display //
Augmented to handle checkbox items. If an item is a checkbox it will //
check if the item is True or False and set select_state. //
Note that we disable entry_refresh_state of both this object and //
the focus object //
//
************************************************************************//
Entry_Update(Integer iFile Integer iAll)
************************************************************************//
//
Augment Entry_Update to not update from the object during a save. The //
extended data-sets should take care of that. Just in case, we support //
a property, Allow_save_entry_update to override this. //
************************************************************************//
IntegerExec_Field_Message(Integer iItem Integer iMsg)
#ELSE
// Character mode version - currently does nothing.
Procedure Copy_Mask_Options Integer iDSO Integer iFile Integer iField ;
Integer iDEO Integer iItem
End_Procedure
// Character mode version - currently does nothing.
Procedure Assign_DD_Label Integer iDSO Integer iFile Integer iField ;
Integer iDEO Integer iItem
End_Procedure
#ENDIF
************************************************************************//
It is important that a DEO only needs to communicate with its //
server. It should not have to find its watched servers. This means that//
requests for item (field) messages to the DSO must ask for the FILE and//
the field. I have restored the DSS_ message to support this but am now //
calling it exec_file_field_MSG. //
************************************************************************//
************************************************************************//
Function Exec_Field_Message //
This function will be called after an Item_Entry, Item_Exit or //
Item_Validate function has been executed. If the item is field-based //
and this object has a server, it will request this server to execute //
the field message for this field. //
************************************************************************//
IntegerFile_Field_Changed_State(Integer iFile Integer iField)
************************************************************************//
Function Field_Field_Changed_State //
Function Item_Field_Changed_State //
Procedure Set Item_Field_Changed_State //
Looks in the Data_Set for the passed file to see if the fieldvalue //
has been changed. //
************************************************************************//
stringFile_Field_Current_Value(Integer iFile Integer iField)
File_Field_Label_Changed(integer iFile integer iField boolean bLong string sLabel)
DD label has changed. If auto_label_state is T, then update any required labels
File_Field_mask_Changed(integer iFile integer iField string sMask)
#IFDEF IS$WINDOWS
DD mask has changed. Update DEOs as needed
File_Field_Option_Changed(integer iFile integer iField integer iOptions integer bClear)
Notify DEO that a field option has changed. Deal with this however you want. Some
items are not set in options (see DD_DEO_MASK). For those we do nothing. Some options
can be handled dynamically by the deo.
integerFile_Field_Select_State(Integer iFile integer iField)
************************************************************************//
Get/Set File_field_select_State //
Get/Set Item_field_select_State //
These direct to the DSO as required. They either set the DSO buffer //
value based on select_state or they return the current state of this //
field. //
//
************************************************************************//
File_Field_Value_Changed(Integer iFile Integer iField String sValue Integer iChangeDisabled)
************************************************************************//
Procedure File_Field_Value_Changed //
This message will be send by Data_Sets whenever a value of a field //
changes. This way DEOs can update their values if necessary. //
************************************************************************//
integerItem_Buffer_Select_State(Integer iItem)
************************************************************************//
Get Item_Buffer_Select_State //
Returns Select_state based on field's buffer value (not the DD buffer //
value). Used by entry_display which must use the real buffer value. //
************************************************************************//
IntegerItem_Entry(Integer iMsg Integer iItem)
************************************************************************//
Function Item_Entry //
************************************************************************//
IntegerItem_Exit(Integer iMsg Integer iItem)
************************************************************************//
Function Item_Exit //
************************************************************************//
IntegerItem_Field_Changed_State(Integer iItem)
StringItem_Field_Current_Value(Integer iItem)
StringItem_Field_Property(Integer iMsg Integer iItem)
#ELSE
//************************************************************************//
// Function Entry //
// Augmented to keep track of changes in Value. Only for CM applications. //
//************************************************************************//
Function Entry Returns Integer
Integer iResult
String sOld_Value
String sNew_Value
Integer iItem
If Not (Extended_deo_State(self)) Begin
Forward Get Entry to iResult
Function_Return iResult
End
Get Current_Item to iItem
Get Value item iItem to sOld_Value
Forward Get Entry to iResult
Get Value item iItem to sNew_Value
If (Item_Changed_State(self,iItem) AND ;
sOld_Value<>sNew_Value AND ;
(Item_NoPut(self,iItem)=0) ) ;
Set Item_Field_Current_Value item iItem to sNew_Value
Function_Return iResult
End_Function
//************************************************************************//
// Procedure Update_Focus_Field //
// This should not be needed at all in character mode. //
//************************************************************************//
Procedure Update_Focus_Field
End_Procedure
#ENDIF
************************************************************************//
Function Item_Field_Property //
This function has been created to have an easy way of getting a //
field based property value from a fields server. //
************************************************************************//
integerItem_Field_Select_State(Integer iItem)
Item_Mask_Changed(integer iItem)
used to notify columns in a multi row object that a mask has changed. (See Dftable.pkg
for replacment of this method). Single item objects don't need to do anything
integerItem_NoPut(integer iItem)
************************************************************************//
Function Item_Noput //
Returns true if the item has the noput option set //
************************************************************************//
Item_Options_Changed(integer iItem)
used to notify columns in a multi row object that options have changed. (See Dftable.pkg
for replacment of this method). Single item objects don't need to do anything
IntegerItem_Validate(Integer iMsg Integer iItem)
************************************************************************//
Function Item_Validate //
************************************************************************//
Item_Value_Changed(Integer iItem String sValue)
Procedure Entry_Defaults
String sValue
Integer iMax
Integer iCount
Integer iBase
Integer iData_File
Integer iData_Field
Integer iDSO
Integer iDSO_File
integer iOldState
integer bOk
integer iOwnerDD
Get Server to iDSO
If Not (Extended_deo_State(self)) Begin
Forward Send Entry_Defaults
Procedure_Return
End
If Not iDSO ;
Procedure_Return
Get Entry_Refresh_State to iOldState
Set Entry_Refresh_State to True
Get Main_File of iDSO to iDSO_File
Get Item_Count to iCount // items in object
Get Item_Limit to iMax // items in row
If Not iMax ;
Move iCount to iMax // if no row, use num items
Get Base_Item to iBase // first item to check
Move (iBase + iMax - 1) to iMax // last item to check
If iCount GT iMax Begin // in case table is a blank row!
For iCount from iBase to iMax
Get Data_File item iCount to iData_File
If iData_File Begin
Get Data_Field item iCount to iData_Field
// if DDO field is changed, it must be a default, set it accordingly.
Get File_field_Changed_state of iDso iData_file iData_Field to bOk
if bOk Begin
Get File_Field_Current_Value of iDSO iData_File iData_Field to sValue
Send Item_Value_Changed iCount sValue
end
end
// Removed conditional check. If defaults exist in the DDO they should be seen in the DEO. It's the
// DDOs that matter.
// If (iData_File=iDSO_File) ;
// move 1 to bOK // if not a parent, apply defaults
// Else If iDSO Begin
// // if field is a parent we only do defaults if
// // its DD has Allow_Foreign_new_Save_State set which indicates
// // that it supports saving new parents when a child is saved
// Get Data_set of iDSO iData_File to iOwnerDD // the DD which owns this data-file
// If iOwnerDD Get Allow_Foreign_new_Save_State of iOwnerDD to bOK
// end
// If bOK Begin
// Get Data_Field item iCount to iData_Field
// Get File_Field_Current_Value of iDSO iData_File iData_Field to sValue
// If (sValue <> "" AND sValue <> "0") ;
// Send Item_Value_Changed iCount sValue
// End
// End
Loop
End
Set Entry_Refresh_State to iOldState
End_Procedure
************************************************************************//
Procedure Item_Value_Changed //
This procedure will be send by File_Field_Value_Changed when //
it found an item it needs to update. This is a good augmentation //
point for a programmer to do its own thing. // //
************************************************************************//
Notify_Focus_Change(Integer iState)
IntegerPrompt_Object(Integer iItem)
************************************************************************//
Functions Prompt_Object and Zoom_Object //
These function have been augmented to supply a Fieldbased Prompt- or //
Zoom-object when no object has been defined locally. //
************************************************************************//
Select_Toggling(integer iItem Integer eState)
Augmented to stop toggling if the item's checkbox_state is false
actually supports: 0-false, 1-true, 2-toggle
Set(integer iItem String sValue)
Set(integer iItem integer bState)
Set(Integer iItem String sValue)
************************************************************************//
Procedure Set Value //
This procedure is used to trap a change of the value of this item //
by user input or by a programmers' action. It will call Item_Field_ //
Value to notify the Data_Set of the value changes. Note that it will //
only notify the Data_Set when there is a change in value. //
//
************************************************************************//
Set(Integer iItem Integer iState)
************************************************************************//
Procedure Set Item_Changed_State //
This procedure is used to trap a change of the value of this item //
by user input or by a programmers' action. It sets its DSO's field //
changed_state to true also. //
************************************************************************//
Set(Integer iItem Integer iState)
Set(Integer iFile Integer iField String sValue)
************************************************************************//
//
Methods to set and get the value of a field. When set all DSOs and DEOs//
are notified. //
Get/Set File_Field_Current_Value - must pass file and field number //
Get/Set Item_Field_Current_Value - uses file and Field of passed item //
************************************************************************//
Set(Integer iItem String sValue)
Set(String ItemVal String TrueVal String FalseVal)
************************************************************************//
Procedure Set CheckBox_Item //
With extended DEOs we only care about the first paramter. This is the //
display value (more of a label really). This does set all the required //
proeprties to support checkbox items. True/false values are obtained //
from the DSO. //
************************************************************************//
Set(String ItemVal)
************************************************************************//
Procedure Set CheckBox_Label //
With extended DEOs we only care about the first paramter. This is the //
display value (more of a label really). This does set all the required //
proeprties to support checkbox items. True/false values are obtained //
from the DSO. //
************************************************************************//
Set(Integer iItem Integer iState)
************************************************************************//
Procedure Set Select_State //
This procedure is used to trap a change of the value of this item //
by user input or by a programmers' action. It will call Item_Field_ //
Value to notify the Data_Set of the value changes. Note that it will //
only notify the Data_Set when there is a change in value. //
//
************************************************************************//
Set(Integer iFile Integer iField Integer iState)
Set(Integer iItem String iState)
SetToolTipFromStatusHelp()
This is a stub. This is augmented when a class imports Extended_DEO_Status_Help_Mixin. This means that Extended_DEO_Status_Help_Mixin
must be imported 'after' this mixin class (Extended_DEO_Mixin).
Update_Focus_Field()
************************************************************************//
Procedure Update_Focus_Field //
Update the focus field value and place it in the local DSO buffer. //
This will also update all dependent items. Only do this if appropriate //
This message is sent when the windows focus changes and is also sent //
berfore an entry_update is processed in the DSO //
************************************************************************//
IntegerZoom_Object(Integer iItem)