Module dbTrckbr.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  : dbTrckbr.pkg
    11// $File title : dbTrackBar
    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 dbExtFrm.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{ OverrideProperty=psToolTip DesignTime=False }
    72{ HelpTopic=dbTrackBar }
    73Class dbTrackBar is a dbFormExternalControl
    74
    75    import_class_protocol Trackbar_Mixin
    76
    77    Procedure Construct_Object
    78       Forward Send Construct_Object
    79       Send Define_Trackbar_Mixin
    80    End_Procedure // Construct_Object
    81
    82    // we must identify all events that result in a changed
    83    // value in the control and notify the DF side about this
    84    // change. OnSetPosition is always called when the slider
    85    // changes.
    86    { MethodType=Event }
    87    Procedure OnSetPosition
    88        Send ControlValueChanged
    89    End_Procedure
    90
    91    // This is passed the DF value and should set the slider's
    92    // value to an appropriate integer value. Default behavior is
    93    // a 1 to 1 mapping.
    94    { MethodType=Property Visibility=Public }
    95    { DesignTime=False }
    96    Procedure Set ControlValue string sVal
    97        Set current_Position to (integer(sVal))
    98    End_Procedure
    99
   100    // This must be return a DF value. Default behavior is to use
   101    // the return the slider's integer value
   102    { MethodType=Property Visibility=Public }
   103    Function ControlValue Returns String
   104        Function_return (Current_position(self))
   105    End_Function
   106
   107End_Class
   108