Module Trckbr.pkg

     1//************************************************************************
     2// Confidential Trade Secret.
     3// Copyright (c) 1997 Data Access Corporation, Miami Florida
     4// as an unpublished work.  All rights reserved.
     5// DataFlex is a registered trademark of Data Access Corporation.
     6//
     7//************************************************************************
     8//************************************************************************
     9//
    10// $File name  : Trckbr.pkg
    11// $File title : Trackbar class
    12// Notice      :
    13// $Author(s)  : John Tuohy
    14//
    15// $Rev History
    16//
    17// 9/8/97    JJT - File created
    18//************************************************************************
    19
    20// Additional PUBLIC INTERFACE
    21//
    22//    PROPERTIES
    23//
    24//    Minimum_Position    integer  0              minimum sliding-mark
    25//    Maximum_Position    integer  100            maximum sliding-mark
    26//    Current_Position    integer  0              current slider position
    27//    Visible_Tick_State  bool     TRUE           ticks should be visible
    28//    Tick_Orientation    INTEGER  tkTOP          ticks should be aligned on top
    29//    Orientation_Mode    INTEGER  slHORZ         slider should be horizontal
    30//    Tick_Frequency      integer  5              frequency of ticks
    31//    Line_Size           integer  1              amount to move per 'line'
    32//    Page_Size           integer  20% of range   amount to move per 'page' (-1 means use Windows' default)
    33//
    34//    For Augmentation:
    35//
    36//    Get/Set ControlValue: Normally slider's expect their value to be an
    37//    integer - which is what the slider must use to display a value. You
    38//    can augment these message to convert DF values to slider integer
    39//    values (Set) and to convert integer slider values to a DF Value (GET).
    40//    This would be an advanced technique.
    41//    Example:
    42//        Procedure Set ControlValue string sVal
    43//             integer iVal
    44//             if sVal eq "A"      Move 0 to iVal
    45//             else if sVal eq "B" Move 1 to iVal
    46//             else                Move 2 to iVal
    47//             Set Current_Position to iVal
    48//        End_Procedure
    49//
    50//        Function ControlValue returns string
    51//             integer iVal
    52//             string sVal
    53//             Get Current_Position to iVal
    54//             If iVal eq 0      Move "A" to sVal
    55//             else if iVal eq 1 Move "B" to sVal
    56//             else              Move "C" to sVal
    57//             Function_Return sVal
    58//         end_Function
    59
    60
    61use ExtFrm.pkg
    62use dfsl_mx.pkg
    63
    64{ DesignerClass=cDTTrackbar }
    65{ OverrideProperty=Current_Position InitialValue=0 }
    66{ OverrideProperty=Minimum_Position InitialValue=0 }
    67{ OverrideProperty=Maximum_Position InitialValue=100 }
    68{ OverrideProperty=Page_Size InitialValue=0 }
    69{ OverrideProperty=Tick_Frequency InitialValue=5 }
    70{ OverrideProperty=Visible_Tick_State InitialValue=True }
    71{ HelpTopic=TrackBar }
    72{ OverrideProperty=Aux_Value DesignTime=False }
    73{ OverrideProperty=Capslock_State DesignTime=False }
    74{ OverrideProperty=Entry_State DesignTime=False }
    75{ OverrideProperty=FontItalics DesignTime=False }
    76{ OverrideProperty=FontSize DesignTime=False }
    77{ OverrideProperty=FontUnderline DesignTime=False }
    78{ OverrideProperty=FontWeight DesignTime=False }
    79{ OverrideProperty=Form_border DesignTime=False }
    80{ OverrideProperty=Form_Datatype DesignTime=False }
    81{ OverrideProperty=Form_Justification_mode DesignTime=False }
    82{ OverrideProperty=Form_Margin DesignTime=False }
    83{ OverrideProperty=Form_Mask DesignTime=False }
    84{ OverrideProperty=Form_border DesignTime=False }
    85{ OverrideProperty=Message DesignTime=False }
    86{ OverrideProperty=Oem_Translate_State DesignTime=False }
    87{ OverrideProperty=Password_State DesignTime=False }
    88{ OverrideProperty=Prompt_Button_mode DesignTime=False }
    89{ OverrideProperty=Prompt_Button_value DesignTime=False }
    90{ OverrideProperty=TextColor DesignTime=False }
    91{ OverrideProperty=TypeFace DesignTime=False }
    92{ OverrideProperty=psToolTip DesignTime=False }
    93
    94Class TrackBar is a FormExternalControl
    95
    96    import_class_protocol Trackbar_Mixin
    97
    98    Procedure Construct_Object
    99       Forward Send Construct_Object
   100       Send Define_Trackbar_Mixin
   101    End_Procedure // Construct_Object
   102
   103    // we must identify all events that result in a changed
   104    // value in the control and notify the DF side about this
   105    // change. OnSetPosition is always called when the slider
   106    // changes.
   107    { MethodType=Event }
   108    Procedure OnSetPosition
   109        Send ControlValueChanged
   110    End_Procedure
   111
   112    // This is passed the DF value and should set the slider's
   113    // value to an appropriate integer value. Default behavior is
   114    // a 1 to 1 mapping.
   115    { MethodType=Property }
   116    { DesignTime=False }
   117    Procedure Set ControlValue string sVal
   118        Set current_Position to (integer(sVal))
   119    End_Procedure
   120
   121    // This must be return a DF value. Default behavior is to use
   122    // the return the slider's integer value
   123    { MethodType=Property }
   124    Function ControlValue Returns String
   125        Function_return (Current_position(self))
   126    End_Function
   127
   128End_Class
   129