home *** CD-ROM | disk | FTP | other *** search
/ ActiveX Programming Unleashed CD / AXU.iso / activex / demos / oletrial / samples / vb / mhtinp / time.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-11-30  |  9.6 KB  |  277 lines

  1. VERSION 4.00
  2. Begin VB.Form frmChangeTime 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "System Time"
  5.    ClientHeight    =   2970
  6.    ClientLeft      =   2295
  7.    ClientTop       =   3270
  8.    ClientWidth     =   4350
  9.    Height          =   3390
  10.    Icon            =   "time.frx":0000
  11.    Left            =   2235
  12.    LinkTopic       =   "Form1"
  13.    LockControls    =   -1  'True
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   2970
  17.    ScaleWidth      =   4350
  18.    ShowInTaskbar   =   0   'False
  19.    Top             =   2910
  20.    Width           =   4470
  21.    Begin VB.CommandButton cmdOkCancelApply 
  22.       Caption         =   "&Apply"
  23.       Enabled         =   0   'False
  24.       Height          =   372
  25.       Index           =   2
  26.       Left            =   2988
  27.       TabIndex        =   3
  28.       Top             =   2484
  29.       Width           =   1212
  30.    End
  31.    Begin VB.CommandButton cmdOkCancelApply 
  32.       Cancel          =   -1  'True
  33.       Caption         =   "&Cancel"
  34.       Height          =   372
  35.       Index           =   1
  36.       Left            =   1692
  37.       TabIndex        =   2
  38.       Top             =   2484
  39.       Width           =   1212
  40.    End
  41.    Begin VB.CommandButton cmdOkCancelApply 
  42.       Caption         =   "OK"
  43.       Default         =   -1  'True
  44.       Height          =   372
  45.       Index           =   0
  46.       Left            =   396
  47.       TabIndex        =   1
  48.       Top             =   2484
  49.       Width           =   1212
  50.    End
  51.    Begin VB.Timer tmrTimeUpdater 
  52.       Interval        =   1000
  53.       Left            =   36
  54.       Top             =   2484
  55.    End
  56.    Begin Threed.SSPanel SSPanel1 
  57.       Height          =   2250
  58.       Left            =   105
  59.       TabIndex        =   4
  60.       Top             =   150
  61.       Width           =   4110
  62.       _Version        =   65536
  63.       _ExtentX        =   7260
  64.       _ExtentY        =   3958
  65.       _StockProps     =   15
  66.       BevelWidth      =   2
  67.       Begin VB.ComboBox cboTimeZoneOffset 
  68.          Height          =   288
  69.          ItemData        =   "time.frx":0442
  70.          Left            =   1512
  71.          List            =   "time.frx":0444
  72.          Style           =   2  'Dropdown List
  73.          TabIndex        =   8
  74.          Top             =   324
  75.          Width           =   1092
  76.       End
  77.       Begin VB.Label Label2 
  78.          Alignment       =   2  'Center
  79.          Caption         =   "Hours Different From Intl. Date Line"
  80.          Height          =   228
  81.          Left            =   72
  82.          TabIndex        =   7
  83.          Top             =   72
  84.          Width           =   3972
  85.       End
  86.       Begin VB.Label Label1 
  87.          Alignment       =   2  'Center
  88.          Caption         =   "&Local Time"
  89.          Height          =   228
  90.          Left            =   72
  91.          TabIndex        =   6
  92.          Top             =   1620
  93.          Width           =   3972
  94.       End
  95.       Begin MhintimeLib.MhTimeInput MhTimeInputCurrentTime 
  96.          Height          =   948
  97.          Left            =   288
  98.          TabIndex        =   5
  99.          TabStop         =   0   'False
  100.          Top             =   684
  101.          Width           =   3576
  102.          _Version        =   65536
  103.          _ExtentX        =   6308
  104.          _ExtentY        =   1672
  105.          _StockProps     =   77
  106.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  107.             name            =   "MS Sans Serif"
  108.             charset         =   0
  109.             weight          =   400
  110.             size            =   24
  111.             underline       =   0   'False
  112.             italic          =   0   'False
  113.             strikethrough   =   0   'False
  114.          EndProperty
  115.          TintColor       =   16711935
  116.          Alignment       =   2
  117.          BevelSize       =   0
  118.          BevelStyle      =   1
  119.          BorderColor     =   -2147483642
  120.          BorderStyle     =   0
  121.          FillColor       =   -2147483633
  122.          LightColor      =   -2147483643
  123.          ShadowColor     =   -2147483632
  124.          TextColor       =   -2147483640
  125.          Text            =   "19:42:02"
  126.          ReadOnly        =   -1  'True
  127.          Spin            =   0
  128.          SpinDelay       =   500
  129.          SpinSpeed       =   500
  130.          Indent          =   0
  131.          AutoHScroll     =   0   'False
  132.          FontStyle       =   3
  133.          Verbose         =   0   'False
  134.          CaretHeight     =   0
  135.          CaretWidth      =   0
  136.          CaretColor      =   -2147483640
  137.          CaretStyle      =   0
  138.          CaretVAlign     =   0
  139.          CaretInterval   =   500
  140.          CaretVisible    =   -1  'True
  141.          Separator       =   58
  142.          TimeFormat      =   2
  143.          Country         =   0
  144.          VAlignment      =   2
  145.          MaxHours        =   23
  146.          MaxMinutes      =   59
  147.          MaxSeconds      =   59
  148.          MinHours        =   0
  149.          MinMinutes      =   0
  150.          MinSeconds      =   0
  151.          SpinChange      =   1
  152.          AllowBlank      =   0   'False
  153.          FocusSelect     =   0   'False
  154.          AM              =   0   'False
  155.       End
  156.       Begin MhintimeLib.MhTimeInput MhTimeInputNewTime 
  157.          Height          =   300
  158.          Left            =   1512
  159.          TabIndex        =   0
  160.          Top             =   1836
  161.          Width           =   1092
  162.          _Version        =   65536
  163.          _ExtentX        =   1926
  164.          _ExtentY        =   529
  165.          _StockProps     =   77
  166.          BackColor       =   16777215
  167.          TintColor       =   16711935
  168.          Alignment       =   2
  169.          BevelSize       =   2
  170.          BevelStyle      =   0
  171.          BorderColor     =   -2147483642
  172.          BorderStyle     =   0
  173.          FillColor       =   16777215
  174.          LightColor      =   -2147483643
  175.          ShadowColor     =   -2147483632
  176.          TextColor       =   -2147483640
  177.          Text            =   "19:45:06"
  178.          ReadOnly        =   0   'False
  179.          Spin            =   2
  180.          SpinDelay       =   500
  181.          SpinSpeed       =   500
  182.          Indent          =   0
  183.          AutoHScroll     =   0   'False
  184.          FontStyle       =   0
  185.          Verbose         =   0   'False
  186.          CaretHeight     =   0
  187.          CaretWidth      =   0
  188.          CaretColor      =   -2147483640
  189.          CaretStyle      =   1
  190.          CaretVAlign     =   1
  191.          CaretInterval   =   500
  192.          CaretVisible    =   -1  'True
  193.          Separator       =   58
  194.          TimeFormat      =   2
  195.          Country         =   0
  196.          VAlignment      =   2
  197.          MaxHours        =   23
  198.          MaxMinutes      =   59
  199.          MaxSeconds      =   59
  200.          MinHours        =   0
  201.          MinMinutes      =   0
  202.          MinSeconds      =   0
  203.          SpinChange      =   1
  204.          AllowBlank      =   0   'False
  205.          FocusSelect     =   0   'False
  206.          AM              =   0   'False
  207.       End
  208.    End
  209. Attribute VB_Name = "frmChangeTime"
  210. Attribute VB_Creatable = False
  211. Attribute VB_Exposed = False
  212. Option Explicit
  213. Private TimeZoneOffset As Integer
  214. Private m_oParent As Object
  215. Private ApplyTimeChanges As Boolean, ApplyTimeZoneChanges As Boolean
  216. Private Sub cboTimeZoneOffset_Click()
  217.     ' indicate that the user has made changes
  218.     If Not ApplyTimeZoneChanges Then
  219.         ApplyTimeZoneChanges = True
  220.         ' enable the apply button
  221.         cmdOkCancelApply(2).Enabled = True
  222.     End If
  223. End Sub
  224. Private Sub cmdOkCancelApply_Click(Index As Integer)
  225.     ' if the user hit ok or apply and there are changes to be applied then apply the changes
  226.      If (Index = 0 Or Index = 2) And (ApplyTimeChanges Or ApplyTimeZoneChanges) Then
  227.         ' set the new system time
  228.         If ApplyTimeChanges Then
  229.             Time = MhTimeInputNewTime
  230.             ApplyTimeChanges = False
  231.         End If
  232.         ' set the time zone offset
  233.         If ApplyTimeZoneChanges Then
  234.             m_oParent.TimeDisplayManager.GreenwichMeanTimeOffset = Int(cboTimeZoneOffset.Text)
  235.             ApplyTimeZoneChanges = False
  236.         End If
  237.         ' disable apply button since changes have been made
  238.         cmdOkCancelApply(2).Enabled = False
  239.     End If
  240.     ' if the user hit ok or cancel then unload the form
  241.     If Index < 2 Then Unload Me
  242. End Sub
  243. Private Sub Form_Load()
  244.     Dim iCount As Integer
  245.     ' center the form to top left screen
  246.     Move 0, 0
  247.     ' setup cboTimeZoneOffset
  248.     With cboTimeZoneOffset
  249.         For iCount = -12 To 12
  250.             .AddItem iCount ' VB4 allows this without a type coercion!
  251.         Next iCount
  252.         ' set to current offset
  253.         .ListIndex = m_oParent.TimeDisplayManager.GreenwichMeanTimeOffset + 12
  254.     End With ' cboTimeZoneOffset
  255.     ' update the controls to show current time
  256.     MhTimeInputCurrentTime.Text = Format$(Time, "h:nn:ss")
  257.     MhTimeInputNewTime.Text = Format$(Time, "h:nn:ss")
  258.     ' disable the apply button.  Needed since setting the .ListIndex of the combo
  259.     '   fires the click event
  260.     cmdOkCancelApply(2).Enabled = False
  261.     ApplyTimeZoneChanges = False
  262. End Sub
  263. Private Sub MhTimeInputNewTime_Change()
  264.     ' indicate that the user has made changes
  265.     If Not ApplyTimeChanges Then
  266.         ApplyTimeChanges = True
  267.         ' enable the apply button
  268.         cmdOkCancelApply(2).Enabled = True
  269.     End If
  270. End Sub
  271. Private Sub tmrTimeUpdater_Timer()
  272.     MhTimeInputCurrentTime.Text = Format$(Time, "h:nn:ss")
  273. End Sub
  274. Public Property Let ParentObject(oNewParent As Object)
  275.     Set m_oParent = oNewParent
  276. End Property
  277.