Module Dfenchk.pkg

     1//************************************************************************
     2// DFENCHK.PKG  -  DfEntry_Checkbox Class
     3//
     4// Copyright (c) 1997 Data Access Corporation, Miami Florida,
     5// All rights reserved.
     6// DataFlex is a registered trademark of Data Access Corporation.
     7//
     8//
     9//************************************************************************
    10// 3.1 changes
    11//     Use dfentry (not dafentry)
    12//************************************************************************
    13//  1/28/98 JJT   Added rgb color support
    14// 8/13/97  JJT - Changed auto_create_prompt_button to Prompt_Button_Mode
    15// 07/23/96 JJT - New Class names
    16// 04/29/96 JJT Added Auto_Size_State
    17// 04/24/96 JJT Added Value label support instead of textbox label support
    18//************************************************************************
    19
    20
    21//    Expected_Usage:
    22//
    23//       Object ck is a DfEntry_CheckBox No_Image {using ...}
    24//            Set Size to ..
    25//            Set Location to ..
    26//            Entry_Item File.Field
    27//            Set CheckBox_item to "Display-Value" "DBTrue" "DBFalse"
    28//       End_Object
    29//
    30//       Object ck is a DfEntry_CheckBox No_Image {using ...}
    31//            Set Size to ..
    32//            Set Location to ..
    33//            Item_List
    34//              Entry_Item File.Field
    35//              Set CheckBox_item to "Display-Value" "DBTrue" "DBFalse"
    36//              Entry_Item File.Field
    37//              Set CheckBox_item to "Display-Value" "DBTrue" "DBFalse"
    38//              :
    39//            End_Item_list
    40//       End_Object
    41//
    42
    43
    44Use DFEntry.pkg
    45
    46{ ClassType=Abstract }
    47{ DesignerClass=cDTCheckBox }
    48{ OverrideProperty=Color InitialValue=clBtnFace }
    49{ OverrideProperty=TextColor InitialValue=clBtnText }
    50{ OverrideProperty=Entry_State DesignTime=False }
    51{ OverrideProperty=Label_Col_Offset DesignTime=False }
    52{ OverrideProperty=Label_Color DesignTime=False }
    53{ OverrideProperty=Label_FontItalics DesignTime=False }
    54{ OverrideProperty=Label_FontSize DesignTime=False }
    55{ OverrideProperty=Label_FontUnderLine DesignTime=False }
    56{ OverrideProperty=Label_FontWeight DesignTime=False }
    57{ OverrideProperty=Label_Justification_Mode DesignTime=False }
    58{ OverrideProperty=Label_Row_Offset DesignTime=False }
    59{ OverrideProperty=Label_TextColor DesignTime=False }
    60{ OverrideProperty=Label_TypeFace DesignTime=False }
    61{ HelpTopic=dbCheckBoxDS }
    62Class dbCheckBoxDS is a dbFormDS
    63
    64  Procedure Construct_Object
    65     integer clr
    66     Forward Send Construct_Object
    67
    68     { EnumList="taRightJustify, taLeftJustify"}
    69     { Category=Appearance }
    70     Property Integer AlignmentMode taRightJustify
    71
    72     Set Border_style to Border_None // default to no border
    73     Set select_mode to Multi_Select // it should already be this.
    74     Delegate Get Color to clr
    75     Set Color to Clr
    76     Delegate Get TextColor to clr
    77     Set TextColor to Clr
    78     Send Define_Select_Mixin // this will override EF label logic
    79     Set Prompt_Button_Mode to PB_PromptOff
    80  End_Procedure // Construct_Object
    81
    82  Import_Class_Protocol Select_Mixin
    83
    84  //  Augment to make sure that all items are indeed checkboxes and
    85  //  that they are all looking right (aspect).
    86  Procedure End_Construct_Object
    87     integer i ic
    88     Forward Send END_CONSTRUCT_OBJECT // as you were.
    89     Get Item_Count to ic
    90     decrement ic
    91     For i from 0 to ic
    92         // if ommited you get a blank value, 0/1 checkbox
    93         If (CheckBox_item_state(self,i)=0) Begin
    94            Set Checkbox_item_State Item i to TRUE
    95            Set Entry_state item i to False
    96         End
    97         Set Button_aspect item i TO BASPECT_CHECKBOX
    98         // ckbox must be ascii window type!!
    99         Set Form_DataType item i to ASCII_WINDOW
   100     Loop
   101  End_Procedure // END_CONSTRUCT_OBJECT
   102
   103  // Must override cell color behavior in form class.
   104  //
   105  { MethodType=Event Visibility=Private }
   106  Procedure Shadow_Display
   107  End_Procedure
   108
   109  { Visibility=Private }
   110  Procedure Page_Object integer iState
   111      If (iState =1) Begin
   112          If (AlignmentMode(self) = taLeftJustify) Set Form_Style 0 To (WS_CHILD + WS_VISIBLE +BS_CHECKBOX +BS_LEFTTEXT)
   113          Else                                     Set Form_Style 0 To (WS_CHILD + WS_VISIBLE +BS_CHECKBOX)
   114      End
   115      Forward Send Page_Object iState
   116  End_Procedure
   117End_Class // DFEntry_CheckBox_DS
   118
   119
   120Use DD_Deomx // mixin support for dd classes
   121
   122{ DataBindable=True }
   123{ HelpTopic=dbCheckbox }
   124Class dbCheckbox is a dbCheckboxDS
   125    Import_Class_Protocol Extended_DEO_Mixin
   126    Import_Class_Protocol Extended_DEO_Status_Help_Mixin
   127    Import_Class_Protocol Extended_DEO_Status_Help_Tooltip_Mixin
   128End_Class
   129
   130