//DDB-FileStart //DDB-HeaderStart // File Name : CUSTMENU.DD // Class Name: Custmenu_DataDictionary // Revision : 10 // Version : 2 Use Windows // Basic Definitions Use DataDict // DataDictionary Class Definition Use DDvalTbl // Validation Table Class Definitions Open Custmenu //DDB-HeaderEnd Class Custmenu_DataDictionary is a DataDictionary Procedure Construct_Object Forward Send Construct_Object Property integer piLastOrderNr Public 0 Property String psMenu Public "TOOLS" End_Procedure Procedure OnConstrain Local String sMenu Get psMenu To sMenu If (sMenu<>"") Constrain Custmenu.Menu Eq sMenu Else Constrain Custmenu.Menu Eq "TOOLS" End_Procedure Function LastOrderNr Returns Integer Local Integer iLast iOldRecnum Local String sMenu Move (psMenu(Self)) to sMenu Move CUSTMENU.RECNUM To iOldRecnum Clear CUSTMENU Move sMenu To CustMenu.Menu Move 99 To CustMenu.MenuOrder Find Lt CUSTMENU By Index.1 [found] Indicate found as CustMenu.Menu eq sMenu If (found) Move CUSTMENU.MENUORDER To iLast If iOldRecnum Begin Clear CUSTMENU Move iOldRecnum To CUSTMENU.RECNUM Find Eq CUSTMENU By Recnum End Function_Return iLast End_Function // LastOrderNr Function FirstOrderNr Returns Integer Local Integer iFirst iOldRecnum Local String sMenu Move (psMenu(Self)) to sMenu Move CUSTMENU.RECNUM To iOldRecnum Clear CUSTMENU Move sMenu To CustMenu.Menu Find Gt CUSTMENU By Index.1 [found] Indicate found as CustMenu.Menu eq sMenu If (found) Move CUSTMENU.MENUORDER To iFirst If iOldRecnum Begin Clear CUSTMENU Move iOldRecnum To CUSTMENU.RECNUM Find Eq CUSTMENU By Recnum End Function_Return iFirst End_Function // FirstOrderNr Procedure MoveUp Local Integer iCurrent iLast iNew iFirst Local String sMenu Move (psMenu(Self)) to sMenu Get Field_Current_Value Field CUSTMENU.MENUORDER To iCurrent // Get FirstOrderNr To iFirst If (iCurrent <> iFirst) Begin Get LastOrderNr To iLast Find Lt Custmenu By Index.1 Move Custmenu.Menuorder To iNew Reread Custmenu Move (iLast+1) To Custmenu.Menuorder Saverecord Custmenu UnLock Clear Custmenu Move sMenu To CustMenu.Menu Move iCurrent To Custmenu.Menuorder Find Eq Custmenu By Index.1 Reread Custmenu // ? Move iNew To Custmenu.Menuorder Saverecord Custmenu UnLock Clear Custmenu Move sMenu To CustMenu.Menu Move (iLast+1) To Custmenu.Menuorder Find Eq Custmenu By Index.1 Reread Custmenu Move iCurrent To Custmenu.Menuorder Saverecord Custmenu UnLock // Display the new menu-item again. Clear Custmenu Move sMenu To CustMenu.Menu Move iNew To Custmenu.Menuorder Find Eq Custmenu By Index.1 Send Request_Assign End End_Procedure // MoveUp Procedure MoveDown Local Integer iCurrent iLast iNew Local String sMenu Move (psMenu(Self)) to sMenu Get Field_Current_Value Field CUSTMENU.MENUORDER To iCurrent // Get LastOrderNr To iLast If (iCurrent <> iLast) Begin Find Gt Custmenu By Index.1 Move Custmenu.Menuorder To iNew Reread Custmenu Move (iLast+1) To Custmenu.Menuorder Saverecord Custmenu UnLock Clear Custmenu Move sMenu To CustMenu.Menu Move iCurrent To Custmenu.Menuorder Find Eq Custmenu By Index.1 Reread Custmenu Move iNew To Custmenu.Menuorder Saverecord Custmenu UnLock Clear Custmenu Move sMenu To CustMenu.Menu Move (iLast+1) To Custmenu.Menuorder Find Eq Custmenu by Index.1 Reread Custmenu Move iCurrent To Custmenu.Menuorder Saverecord Custmenu UnLock // Display the new menu-item again. Clear Custmenu Move sMenu To CustMenu.Menu Move iNew To Custmenu.Menuorder Find Eq Custmenu By Index.1 Send Request_Assign End End_Procedure // MoveDown // Save the last order Nr. Procedure Request_Save Local String sMenu Get psMenu To sMenu If (sMenu="") Move "TOOLS" To sMenu Clear CustMenu Move sMenu To CustMenu.Menu move 99 to CustMenu.MenuOrder Find lt CustMenu by Index.1 [Not Found] Clear CustMenu set piLastOrderNr to CustMenu.MenuOrder Forward send Request_Save End_Procedure Procedure Creating Forward send Creating Move (psMenu(Self)) to CustMenu.Menu move (piLastOrderNr(Self)+1) to CustMenu.MenuOrder End_Procedure // Define_Fields: // This procedure is used to set up all data-dictionary rules. Procedure Define_Fields Forward Send Define_Fields //DDB-Generated-Code-Location //DDB-DefineFieldStart Set Main_File To Custmenu.File_Number Set Cascade_Delete_State To FALSE Set Foreign_Field_Options DD_KEYFIELD To DD_AUTOFIND DD_NOPUT DD_FINDREQ Set Foreign_Field_Options DD_INDEXFIELD To DD_NOPUT DD_FINDREQ Set Foreign_Field_Options DD_DEFAULT To DD_DISPLAYONLY // Field-based properties....................... // Custmenu.Description // Custmenu.Instruction // Custmenu.Menuorder // Custmenu.Changeable_X // Custmenu.Createdate //DDB/ Comment_Short Field Custmenu.Createdate To "Date that this record is created. This field is automatically filled from within the subclass" Set Status_Help Field Custmenu.Createdate To "Date of creation" // Custmenu.Createtime //DDB/ Comment_Short Field Custmenu.Createtime To "Time(HHMMS) that this record is created. This field is automatically filled from within the subclass" Set Status_Help Field Custmenu.Createtime To "Time created" // Custmenu.Createuser //DDB/ Comment_Short Field Custmenu.Createuser To "Network username who created the record. This field is automatically filled from within the subclass" Set Status_Help Field Custmenu.Createuser To "Username of the person that created this record." // Custmenu.Modifydate //DDB/ Comment_Short Field Custmenu.Modifydate To "Date of the last modification of this record." Set Status_Help Field Custmenu.Modifydate To "Last modification date" // Custmenu.Modifytime //DDB/ Comment_Short Field Custmenu.Modifytime To "Time of the last modification of this record." Set Status_Help Field Custmenu.Modifytime To "Last modification time" // Custmenu.Modifyuser //DDB/ Comment_Short Field Custmenu.Modifyuser To "Network username of user that made the last modification." Set Status_Help Field Custmenu.Modifyuser To "Username of the person that made the last modification." // Custmenu.Delete_Flag //DDB/ Comment_Short Field Custmenu.Delete_Flag To "Delete flag of this record." Set Status_Help Field Custmenu.Delete_Flag To "Delete flag. X if record is deleted." // Custmenu.Action_Flag Set Status_Help Field Custmenu.Action_Flag To "Action flag" // Custmenu.Menu //DDB/ Comment_Short Field Custmenu.Menu To "Points TH to appropriate menu structure" // Custmenu.Reserved1 //DDB/ Comment_Short Field Custmenu.Reserved1 To "Reserved field. This field is intended for use in nonstandard Accoflex versions." // Custmenu.Reserved2 //DDB/ Comment_Short Field Custmenu.Reserved2 To "Reserved field. This field is intended for use in nonstandard Accoflex versions." //DDB-DefineFieldEnd End_Procedure // Define_Fields // Field_Defaults: // This procedure is used to establish default field values. Procedure Field_Defaults Forward Send Field_Defaults //DDB-Generated-Code-Location //DDB-FieldDefaultStart Set Field_Changed_Value Field Custmenu.Changeable_X To "X" //DDB-FieldDefaultEnd End_Procedure // Field_Defaults End_Class // Custmenu_DataDictionary //DDB-FileEnd