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
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    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    
   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    
   116    
   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    
   124    Function ControlValue Returns String
   125        Function_return (Current_position(self))
   126    End_Function
   127
   128End_Class