Module Dfddpklt.pkg

     1//****************************************************************************//
     2//                                                                            //
     3// $File name  : dfddpklt.pkg                                                 //
     4// $File title :                                                              //
     5// Notice      :                                                              //
     6// $System     : Data Dictionary                                              //
     7// Created     : 05/28/96 08:32 am                                            //
     8// $Last Rev   : 05/28/96 08:32 am                                            //
     9//                                                                            //
    10// $Description                                                               //
    11//  Creates DFValdiation_List class and an object named Validation_lit which  //
    12//  can be used as a prompt for any validation table. Must be defined in the  //
    13//  iPrompt statement                                                         //
    14//                                                                            //
    15// $Rev History                                                               //
    16//JT 07/23/96 New Class names
    17//JT 05/28/96 Created                                                         //
    18//                                                                            //
    19//****************************************************************************//
    20
    21Use DataDict.pkg
    22Use DfClient.pkg
    23Use DFPcklst.pkg
    24Use DD_Pklst.pkg // Validation list picklist mixin class
    25
    26{ Visibility=Private }
    27{ HelpTopic=ValidationPickList }
    28Class ValidationPickList is a PickList
    29
    30   Procedure Construct_Object
    31      Forward Send Construct_Object
    32      Send Define_Validation_List_Mixin
    33      Delegate Set List_Object to self
    34   End_Procedure // Construct_Object
    35
    36   Import_Class_Protocol Validation_List_Mixin
    37
    38  // as of 15.1 we changed all deactivating/activating signatures to not return values (see windows.pkg / ComboForm / Activating for more)
    39   Procedure Activating //Returns Integer
    40     integer iRVal
    41     Set Invoking_Object_id to (Focus(desktop))
    42     Send Initialize_List
    43     Delegate Send Initialize_Client
    44     Forward Get MSG_Activating to iRVal
    45     Procedure_Return iRval
    46  End_Procedure // Activating
    47
    48  Procedure Mouse_Up
    49  end_procedure
    50
    51  Procedure Mouse_Click
    52     Send Ok
    53  End_Procedure
    54
    55  // validation lists have no server. You can't just set server to 0 or it
    56  // will delegate. This kills it.
    57  Function Server returns integer
    58  end_function
    59End_Class // ValidationPickList
    60
    61
    62
    63{ HelpTopic=ValidationList }
    64Class ValidationList is a dbModalPanel
    65
    66   Procedure Construct_Object
    67      Forward Send Construct_Object
    68      { Category=Appearance }
    69      { PropertyType=Boolean }
    70      Property Integer Auto_Size_State  True
    71      Property String  Table_Title      '' // figure it out
    72      Set pbSizeToClientArea to True
    73      //  Set Size     to 100 300
    74      // adjustment for client sizing size of sellist + r/l margins. For height allow button height and 1 more margin
    75      Set Size     to (68+5+5+5+14) (279+5+5) 
    76      Set piMinSize to 80 110
    77
    78      Object oValList is a ValidationPickList
    79         Set Location          to 5 5
    80         Set Size              to 68 279
    81         Set Form_Width Item 0 to 270
    82         set peAnchors to anAll
    83      End_Object
    84
    85      Send Add_Button C_$OK     Msg_Ok
    86      Send Add_Button C_$Cancel Msg_Cancel
    87
    88   End_Procedure // Construct_Object
    89
    90   //
    91   // Augmentation point to support various description/data Display formats.
    92   //
    93   Function Code_Description_Value String DescVal String DataVal returns string
    94      Function_Return (Private.Code_Description_Value(oValList,DescVal,DataVal))
    95   End_Function // Code_Description_Value
    96
    97
    98   { MethodType=Property }
    99   Procedure Set Sort_State Integer iState
   100      Set Sort_State of (oValList) to iState
   101   End_Procedure
   102
   103   { MethodType=Property }
   104   Function Sort_State Integer iState returns integer //jjt*mang
   105      Function_Return (sort_State(oValList))
   106   End_Function
   107
   108   { MethodType=Property }
   109   { EnumList="CD_Code_Display_Code, CD_Code_Display_Description, CD_Code_Display_Both" }
   110   { Category=Behavior }
   111   Procedure Set Code_Display_Mode Integer iMode
   112      Set Code_display_Mode of oValList to iMode
   113   End_Procedure
   114
   115   { MethodType=Property }
   116   Function Code_Display_Mode Integer iState returns integer //jjt*mang
   117      Function_Return (Code_display_Mode(oValList))
   118   End_Function
   119
   120   { MethodType=Property }
   121   { PropertyType=Boolean }
   122   Procedure Set Static_State Integer iState
   123      Set Static_State of oValList to iState
   124   End_Procedure
   125
   126   { MethodType=Property }
   127   Function Static_State Integer iState returns Integer //jjt*mang
   128      Function_Return (Static_State(oValList))
   129   End_Function
   130
   131   { MethodType=Property Visibility=Private }
   132   Function Working_Title returns string
   133     Integer iSrvr iFile iField iObj iValObj
   134     String sTitle
   135     Get Table_Title to sTitle
   136     If sTitle eq '' Begin
   137        Move (oValList(self)) to iValObj
   138        Get Current_Server of iValObj to iSrvr
   139        Get Current_File   of iValObj to iFile
   140        If (iSrvr AND iFile) Begin
   141           Get Current_Field of iValObj to iField
   142           Get File_Field_Table_Object of iSrvr iFile iField to iObj
   143           If iObj get Table_Title of iObj to sTitle
   144           If sTitle eq '' ;
   145              Move DD_VALIDATION_LIST_TITLE to sTitle
   146        End
   147     End
   148     Function_Return sTitle
   149   End_Procedure // Working_Title
   150
   151   { Visibility=Private }
   152   Procedure Initialize_Client
   153     Integer iObj iWidth iMode
   154     Set Label to (Working_Title(self))
   155     If (Auto_Size_State(self)) Begin
   156        Get List_Object to iObj
   157        Get Working_Code_Display_Mode of iObj to iMode
   158        If iMode eq CD_Code_Display_Description ;
   159           Move (30*6) to iWidth
   160        Else If iMode eq CD_Code_Display_Code ;
   161           Move (8*8) to iWidth
   162        Else ;
   163           Move ( (30*6) + (8*8) ) to iWidth
   164        Move ( iWidth MAX 120) to iWidth
   165        Set Form_Width of iObj Item 0 to iWidth
   166        Add 9 to iWidth
   167        // Set Size to (Hi(Size(Self))) (iWidth+16) // 16 was width guess
   168        Set Size of iObj to (Hi(Size(iObj))) iWidth
   169        Set Size to (Hi(Size(Self))) (iWidth+5+5)
   170        Send Position_Child_Objects
   171     End
   172     //
   173  End_Procedure // Initialize_Client
   174
   175End_Class
   176
   177// This one object serves all DD validation table needs.
   178//
   179Object Validation_List is a ValidationList
   180  Move self to DD_Global_Validation_Prompt_Object
   181End_Object
   182