Module cComDbActiveXControl.pkg

     1Use FlexCom20.pkg
     2Use EnFrm_ds.pkg
     3Use DFDEOft.pkg      // deo floating panel object
     4Use DFNav_mx.pkg       // Navigation changes for DF DEOs
     5Use DFCdDeo.pkg        // DEO Code message support
     6Use DD_Deomx.pkg
     7
     8
     9// Used by single item DEOs that need to emulate all the entry interfaces.
    10// Used by activeX DD aware controls.
    11
    12{ Visibility=Private }
    13Class cItemHelper is a DFBaseEntry
    14
    15    Procedure Construct_Object
    16        forward send construct_object
    17        // helper object must never take focus
    18        set focus_mode to no_Activate
    19        // There should be no messages in the helper that delegate unless it is
    20        // specifically called for. We set this to reduce the chance of side-effects
    21        set delegation_mode to no_Delegation
    22    end_procedure
    23
    24    // gets called during construction and calls parent - cancel
    25    function Parent_Ratios returns integer
    26    end_function
    27
    28    // If value is changed, we need to notify the owner control of the change
    29    Procedure set Value integer iItem string sVal
    30        delegate Send OnRefreshControl sVal // parent must understand this
    31        Forward Set Value iItem to sVal
    32    End_Procedure
    33
    34    // we let shadow state of owner object do all the work.
    35
    36    Procedure Set Shadow_State integer iItem integer bState
    37        delegate set shadow_state iItem to bState
    38    end_procedure
    39
    40    Function Shadow_State integer iItem returns integer
    41        function_return (shadow_state(parent(self),iItem))
    42    end_function
    43
    44end_Class
    45
    46
    47Class dbItemMixin is a Mixin
    48
    49    // mixin constructor
    50    { Visibility=Private }
    51    Procedure Define_dbItemMixin
    52        Property handle phoEntryForm (Create(self,U_cItemHelper)) // create helper child object
    53    end_procedure
    54
    55    { MethodType=Property }
    56    Function Prototype_Object returns handle
    57        function_return self
    58    end_function
    59
    60    { MethodType=Property }
    61    { InitialValue=0 }
    62    { ItemParameter=1 }
    63    { Category=Appearance }
    64    Procedure Set Prompt_Object Integer iItem Integer hoPrompt
    65         set Prompt_Object of (phoEntryForm(self)) iItem to hoPrompt
    66    End_Procedure
    67
    68    { MethodType=Property }
    69    Function Prompt_Object Integer iItem Returns Handle
    70         Function_Return (Prompt_Object(phoEntryForm(self),iItem))
    71    End_Function
    72
    73    { MethodType=Property }
    74    Procedure Set Zoom_Object Integer iItem Handle hoPrompt
    75         set Zoom_Object of (phoEntryForm(self)) iItem to hoPrompt
    76    End_Procedure
    77
    78    { MethodType=Property }
    79    Function Zoom_object Integer iItem Returns Handle
    80        Function_Return (Zoom_Object(phoEntryForm(self),iItem))
    81    End_Function
    82
    83    { MethodType=Property }
    84    Function Data_File Integer iItem returns Integer
    85        function_return (Data_file(phoEntryForm(self),iItem))
    86    End_Function
    87
    88    { MethodType=Property }
    89    Procedure Set Data_File integer iItem integer iFile
    90        Set Data_File of (phoEntryForm(self)) iItem to iFile
    91    End_procedure
    92
    93    { MethodType=Property }
    94    Function Data_Field Integer iItem returns Integer
    95        function_return (Data_field(phoEntryForm(self),iItem))
    96    End_Function
    97
    98    { MethodType=Property }
    99    Procedure Set Data_Field integer iItem integer iField
   100        Set Data_Field of (phoEntryForm(self)) iItem to iField
   101    End_procedure
   102
   103    { MethodType=Property }
   104    Procedure Set Item_Changed_State Integer iItem Integer iState
   105        Set Item_Changed_state of (phoEntryForm(self)) iItem to iState
   106        If (iState and changed_state(self)=false) set changed_state to true
   107    End_Procedure
   108
   109    { MethodType=Property }
   110    Function Item_Changed_State Integer iItem returns Integer
   111        Function_Return (Item_Changed_State(phoEntryForm(self),iItem))
   112    End_Function
   113
   114    { MethodType=Property }
   115    Procedure Set Value integer iItem string sValue
   116        set Value of (phoEntryForm(self)) iItem to sValue
   117    End_Procedure
   118
   119    { MethodType=Property }
   120    Function Value integer iItem returns string
   121        Function_return (Value(phoEntryForm(self),iItem))
   122    End_Function
   123
   124    { MethodType=Property }
   125    Procedure Set Select_State integer iItem integer iState
   126        set Select_state of (phoEntryForm(self)) iItem to iState
   127    End_Procedure
   128
   129    { MethodType=Property }
   130    Function Select_State integer iItem returns integer
   131        Function_return (Select_state(phoEntryForm(self),iItem))
   132    End_Function
   133
   134    { MethodType=Property }
   135    Procedure Set Checkbox_Item_State Integer iItem Integer iState
   136        Set CheckBox_item_state of (phoEntryForm(self)) iItem to iState
   137    End_Procedure
   138
   139    { MethodType=Property }
   140    Function Checkbox_Item_State Integer iItem returns Integer
   141        Function_Return (CheckBox_item_State(phoEntryForm(self),iItem))
   142    End_Function
   143
   144    { MethodType=Property }
   145    Function Item_Options integer iItem returns integer
   146        Function_return (Item_options(phoEntryForm(self),iItem))
   147    end_function
   148
   149    { MethodType=Property }
   150    Procedure set Item_Options integer iItem integer iOptions
   151        set Item_options of (phoEntryForm(self)) iItem to iOptions
   152    end_procedure
   153
   154    { MethodType=Property }
   155    Function Form_Options integer iItem returns integer
   156        Function_return (Form_options(phoEntryForm(self),iItem))
   157    end_function
   158
   159    { MethodType=Property }
   160    Procedure set Form_Options integer iItem integer iOptions
   161        set Form_options of (phoEntryForm(self)) iItem to iOptions
   162    end_procedure
   163
   164    { MethodType=Property }
   165    Function Form_Datatype integer iItem returns integer
   166        Function_return (Form_Datatype(phoEntryForm(self),iItem))
   167    end_function
   168
   169    { MethodType=Property }
   170    Procedure set Form_Datatype integer iItem integer iType
   171        set Form_Datatype of (phoEntryForm(self)) iItem to iType
   172    end_procedure
   173
   174    { MethodType=Property }
   175    Function Form_Mask integer iItem returns string
   176        Function_return (Form_Mask(phoEntryForm(self),iItem))
   177    end_function
   178
   179    { MethodType=Property }
   180    Procedure set Form_Mask integer iItem String sMask
   181        set Form_Datatype of (phoEntryForm(self)) iItem to sMask
   182    end_procedure
   183
   184    { MethodType=Property }
   185    Function Item_Option integer iItem integer iOption returns integer
   186        integer iRet
   187        // must use this format (not expression)
   188        get item_option of (phoEntryForm(self)) iItem iOption to iRet
   189        function_return iRet
   190    end_function
   191
   192    { MethodType=Property }
   193    Procedure set Item_Option integer iItem integer iOption integer iState
   194        set Item_option of (phoEntryForm(self)) iItem to iOption iState
   195    end_procedure
   196
   197    { MethodType=Property }
   198    Procedure Set Item_Entry_msg Integer iItem Integer hMsg
   199        set Item_entry_msg of (phoEntryForm(self)) iItem to hMsg
   200    end_procedure
   201
   202    { MethodType=Property }
   203    Function Item_Entry_msg Integer iItem Returns Integer
   204        function_return (Item_entry_msg(phoEntryForm(self),iItem))
   205    end_procedure
   206
   207    { MethodType=Property }
   208    Procedure Set Item_Exit_msg Integer iItem Integer hMsg
   209        set Item_exit_msg  of (phoEntryForm(self)) iItem to hMsg
   210    end_procedure
   211
   212    { MethodType=Property }
   213    Function Item_Exit_msg Integer iItem Returns Integer
   214        function_return (Item_Exit_msg(phoEntryForm(self),iItem))
   215    end_procedure
   216
   217    { MethodType=Property }
   218    Procedure Set Item_Validate_msg Integer iItem Integer hMsg
   219        set Item_validate_msg  of (phoEntryForm(self)) iItem to hMsg
   220    end_procedure
   221
   222    { MethodType=Property }
   223    Function Item_Validate_msg integer iItem returns integer
   224        function_return (Item_Validate_msg(phoEntryForm(self),iItem))
   225    end_procedure
   226
   227
   228    { MethodType=Property Visibility=Private }
   229    Procedure Set Select_Mode integer iMode
   230        set Select_Mode of (phoEntryForm(self)) to iMode
   231    End_Procedure
   232
   233    { MethodType=Property Visibility=Private }
   234    Function Select_Mode returns integer
   235        Function_return (Select_Mode(phoEntryForm(self)))
   236    End_Function
   237
   238    { MethodType=Property Visibility=Private }
   239    Procedure Set Current_Item integer iItem
   240    End_Procedure
   241
   242    { Visibility=Private }
   243    Procedure Set New_Item integer iItem
   244    End_Procedure
   245
   246    { MethodType=Property Visibility=Private }
   247    Function Current_Item returns integer
   248        Function_return (current_item(phoEntryForm(self)))
   249    End_Function
   250
   251    { MethodType=Property Visibility=Private }
   252    Function Item_Count  Returns integer
   253        Function_return (Item_count(phoEntryForm(self)))
   254    End_Function
   255
   256    { MethodType=Property Visibility=Private }
   257    Function Item_Limit  Returns integer
   258        Function_return (Item_Limit(phoEntryForm(self)))
   259    End_Function
   260
   261    { MethodType=Property Visibility=Private }
   262    Function Base_Item  Returns integer
   263        Function_return (Base_Item(phoEntryForm(self)))
   264    End_Function
   265
   266    { MethodType=Property Visibility=Private }
   267    procedure Set Object_Validation integer bOn
   268        set Object_Validation of  (phoEntryForm(self)) to bOn
   269    end_procedure
   270
   271    { MethodType=Property Visibility=Private }
   272    Function Object_Validation returns integer
   273        function_return (Object_Validation(phoEntryForm(self)))
   274    end_procedure
   275
   276    { Visibility=Private }
   277    procedure Entry_Clear integer iFile
   278        send Entry_Clear of (phoEntryForm(self)) iFile
   279    end_procedure
   280
   281    { Visibility=Private }
   282    procedure Entry_Clear_All integer iFile
   283        Send Entry_Clear_All of (phoEntryForm(self)) iFile
   284    end_procedure
   285
   286    { Visibility=Private }
   287    procedure Entry_Display integer iFile integer flag
   288        Send Entry_display of (phoEntryForm(self)) iFile flag
   289    End_procedure
   290
   291    { Visibility=Private }
   292    procedure Entry_Update integer iFile integer flag
   293        Send Entry_update of (phoEntryForm(self)) iFile flag
   294    end_procedure
   295
   296    { Visibility=Private }
   297    Procedure Entry_Autofind integer eFindMode integer iItem
   298    end_procedure
   299
   300
   301    { MethodType=Event }
   302    procedure Refresh integer notifyMode
   303        Send refresh of (phoEntryForm(self)) notifyMode
   304    end_procedure
   305
   306    // Called by exec_validate, which calls item_validate
   307    { Visibility=Private }
   308    function Valid_Item integer iItem returns integer
   309        integer iFail
   310        handle hMsg
   311        If (Object_Validation(self)) Begin
   312            get item_Validate_msg iItem to hMsg
   313            Get Item_validate hMsg iItem to iFail
   314        end
   315        Function_return (iFail<>0)
   316    end_function
   317
   318
   319    // augment to provide item/field validate and exit
   320    { MethodType=Event }
   321    Procedure Exiting Handle hoDestination Returns Integer
   322        integer iFail
   323        get exec_Validate 0 to iFail
   324        If not iFail ;
   325            get exec_exit 0 to iFail
   326        Function_return iFail
   327    end_procedure
   328
   329    // augment to provide item/field entry
   330    { MethodType=Event }
   331    procedure Entering returns integer
   332        integer iFail
   333        get exec_entry 0 to iFail
   334        Function_return iFail
   335    end_procedure
   336
   337    // validate the one item by calling valid_item
   338    Function Validate_Items Boolean bNotFindReq Returns Integer
   339        Function_return (Valid_item(self,0))
   340    end_function
   341
   342    { NoDoc=True }
   343    Procedure Delete_Data
   344        send delete_data of (phoEntryForm(self))
   345    end_procedure
   346
   347    { Visibility=Private }
   348    procedure Update_Dependent_Items
   349    end_procedure
   350
   351    // augment to destroy child helper object
   352    { MethodType=Event  NoDoc=True }
   353    Procedure Destroy_Object
   354        handle hoEF
   355        get object_id of (phoEntryForm(self)) to hoEF
   356        if hoEF send destroy of hoEF
   357        forward send destroy_object
   358    end_procedure
   359
   360
   361End_Class
   362
   363
   364
   365// Create ActiveX class that understands single item "dfentry" logic
   366{ ClassType=Abstract }
   367{ HelpTopic=cComActiveXEntryControl_ }
   368Class cComActiveXEntryControl_ Is a cComActiveXControl
   369
   370    Procedure Construct_Object
   371        Forward Send Construct_Object
   372        send define_dbItemMixin
   373    End_Procedure
   374
   375    Import_class_protocol dbItemMixin
   376
   377End_Class
   378
   379// Mixes in the Entry_Form DEO logic to control
   380{ ClassType=Abstract }
   381{ HelpTopic=cComDbActiveXControl_ }
   382Class cComDbActiveXControl_ is a cComActiveXEntryControl_
   383    Import_Class_Protocol Entry_Form_DS_mixin
   384End_Class
   385
   386// Adds VDF logic and DEO DD support. This is the class that should be used to create
   387// activeX control sub-classes
   388{ HelpTopic=cComDbActiveXControl }
   389{ DataBindable=True }
   390Class cComDbActiveXControl is a cComDbActiveXControl_
   391
   392    Procedure Construct_Object
   393        Forward Send Construct_Object no_image
   394
   395        Send Define_DFNavigation  // GUI navigate changes
   396        Set Validate_Mode to VALIDATE_ON_SAVE_NEXT
   397
   398    End_Procedure // Construct_Object
   399
   400    Import_Class_Protocol DFNavigate_Mixin
   401    Import_Class_Protocol DFCode_DEO_Mixin
   402
   403    Import_Class_Protocol Extended_DEO_Mixin
   404    Import_Class_Protocol Extended_DEO_Status_Help_Mixin
   405    // Import_Class_Protocol Extended_DEO_Prompt_Mixin // not currently supported
   406
   407    //  Returns TRUE to indicate that this is a DEO control. This is used by
   408    //  if you are within a DEO control message and should therefore
   409    //  send a DEO message.
   410    { MethodType=Property }
   411    Function DEO_Control_Object Returns integer
   412        Function_Return 1
   413    End_Function // DEO_Control_Object
   414
   415    // This is called by the entry_item command to assign data_file and data_field. Normally
   416    // you would never use this message to bind the data, but you could
   417    Procedure Bind_Data integer iFile Integer iField
   418        Set Data_File   0 to iFile
   419        Set Data_Field  0 to iField
   420    End_Procedure // Bind_Data
   421
   422    // added to improve autofind logic
   423    { Visibility=Private }
   424   procedure DoAutoFind
   425        Integer bChanged bOn
   426        // both changed_state and item_changed_state must be set for an autofind. If a default
   427        // value is set item_changed_state will be true and changed_state will be false. We want to
   428        // ignore these conditions
   429        get item_changed_State item 0 to bChanged
   430        if (bChanged and changed_state(self)) begin
   431            get item_option item 0 AUTOFIND_BIT to bOn
   432            if bOn begin
   433                get item_option item 0 AUTOFIND_GE_BIT to bOn
   434                Send entry_autofind (if(bOn,GE,EQ)) 0
   435            end
   436        end
   437    end_procedure
   438
   439    // added to improve autofind
   440    { NoDoc=True }
   441    Procedure Exiting Handle hoDestination Returns Integer
   442        integer bErr
   443        // although exiting does not do a validate it should do an
   444        // autofind (if autofind is needed). This is consisent with
   445        // character mode behavior.
   446        send doAutofind // // this does an autofind if needed, this is needed before save
   447        Forward get msg_exiting hoDestination to bErr
   448        function_return bErr
   449    end_procedure
   450
   451    { NoDoc=True }
   452    procedure Request_Save
   453        Send doAutofind // this does an autofind if needed, this is needed before save
   454        forward send request_save
   455    end_procedure
   456
   457
   458End_Class
   459
   460
   461
   462
   463
   464
   465
   466
   467
   468
   469
   470
   471
   472
   473
   474
   475
   476
   477
   478
   479
   480
   481
   482
   483
   484
   485
   486