home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / vrac / leddsp12.zip / SAMPLE.FRM < prev    next >
Text File  |  1994-12-08  |  7KB  |  292 lines

  1. VERSION 2.00
  2. Begin Form Sample 
  3.    Caption         =   "LED Display Sample Program"
  4.    ClientHeight    =   5436
  5.    ClientLeft      =   852
  6.    ClientTop       =   2148
  7.    ClientWidth     =   7380
  8.    Height          =   5904
  9.    Left            =   780
  10.    LinkTopic       =   "Sample"
  11.    ScaleHeight     =   453
  12.    ScaleMode       =   3  'Pixel
  13.    ScaleWidth      =   615
  14.    Top             =   1752
  15.    Width           =   7524
  16.    Begin CommandButton Command13 
  17.       Caption         =   "Italics ON/OFF"
  18.       Height          =   375
  19.       Left            =   3516
  20.       TabIndex        =   14
  21.       Top             =   4884
  22.       Width           =   3735
  23.    End
  24.    Begin CommandButton Command12 
  25.       Caption         =   "Clear Display"
  26.       Height          =   255
  27.       Left            =   168
  28.       TabIndex        =   13
  29.       Top             =   5028
  30.       Width           =   2175
  31.    End
  32.    Begin CommandButton Command11 
  33.       Caption         =   "Cycle Some Colors"
  34.       Height          =   375
  35.       Left            =   3516
  36.       TabIndex        =   12
  37.       Top             =   4416
  38.       Width           =   3735
  39.    End
  40.    Begin CommandButton Command9 
  41.       Caption         =   "Set Left/Right Justify"
  42.       Height          =   372
  43.       Left            =   168
  44.       TabIndex        =   9
  45.       Top             =   3072
  46.       Width           =   2172
  47.    End
  48.    Begin Frame Frame1 
  49.       Caption         =   "Enter Text Numeric"
  50.       Height          =   1095
  51.       Left            =   108
  52.       TabIndex        =   8
  53.       Top             =   1884
  54.       Width           =   3015
  55.       Begin TextBox Text1 
  56.          Height          =   375
  57.          Left            =   240
  58.          TabIndex        =   11
  59.          Top             =   360
  60.          Width           =   1815
  61.       End
  62.       Begin CommandButton Command10 
  63.          Caption         =   "OK"
  64.          Height          =   255
  65.          Left            =   2160
  66.          TabIndex        =   10
  67.          Top             =   720
  68.          Width           =   735
  69.       End
  70.    End
  71.    Begin CommandButton Command8 
  72.       Caption         =   "Leading Zeros"
  73.       Height          =   375
  74.       Left            =   3516
  75.       TabIndex        =   7
  76.       Top             =   1908
  77.       Width           =   3735
  78.    End
  79.    Begin CommandButton Command7 
  80.       Caption         =   "Number of Digits"
  81.       Height          =   375
  82.       Left            =   3516
  83.       TabIndex        =   6
  84.       Top             =   2412
  85.       Width           =   3735
  86.    End
  87.    Begin CommandButton Command6 
  88.       Caption         =   "Digit Height"
  89.       Height          =   375
  90.       Left            =   3516
  91.       TabIndex        =   5
  92.       Top             =   2916
  93.       Width           =   3735
  94.    End
  95.    Begin CommandButton Command5 
  96.       Caption         =   "Reset Counter"
  97.       Height          =   255
  98.       Left            =   192
  99.       TabIndex        =   4
  100.       Top             =   4692
  101.       Width           =   2175
  102.    End
  103.    Begin CommandButton Command4 
  104.       Caption         =   "Toggle Unlit Semgent State"
  105.       Height          =   375
  106.       Left            =   3516
  107.       TabIndex        =   3
  108.       Top             =   3924
  109.       Width           =   3735
  110.    End
  111.    Begin CommandButton Command3 
  112.       Caption         =   "Stop Counter"
  113.       Height          =   255
  114.       Left            =   180
  115.       TabIndex        =   2
  116.       Top             =   4344
  117.       Width           =   2175
  118.    End
  119.    Begin Timer Timer1 
  120.       Left            =   -12
  121.       Top             =   -72
  122.    End
  123.    Begin CommandButton Command2 
  124.       Caption         =   "Scroll Mode"
  125.       Height          =   375
  126.       Left            =   3504
  127.       TabIndex        =   1
  128.       Top             =   3420
  129.       Width           =   3735
  130.    End
  131.    Begin CommandButton Command1 
  132.       Caption         =   "Start Counter"
  133.       Height          =   255
  134.       Left            =   180
  135.       TabIndex        =   0
  136.       Top             =   3996
  137.       Width           =   2175
  138.    End
  139.    Begin LedDisp LedDisplay1 
  140.       DigitHeight     =   38
  141.       Digits          =   6
  142.       Height          =   1632
  143.       Italic          =   1  'True
  144.       LeadingZeros    =   0
  145.       Left            =   60
  146.       Mode            =   0  'Non-Scroll
  147.       TextColor       =   &H0000FF00&
  148.       TextEntry       =   1  'Right
  149.       Top             =   144
  150.       UnlitSegments   =   1  'On
  151.       Width           =   7176
  152.    End
  153. End
  154. Dim gCount As Integer
  155. Dim gColor(10) As Long
  156.  
  157. Sub Command1_Click ()
  158.     timer1.Interval = 1000
  159. End Sub
  160.  
  161. Sub Command10_Click ()
  162.     LedDisplay1.Text = Text1.Text
  163. End Sub
  164.  
  165. Sub Command11_Click ()
  166.     Static tNdx As Integer
  167.  
  168.     LedDisplay1.TextColor = gColor(tNdx)
  169.     tNdx = (tNdx + 1) Mod 10
  170. End Sub
  171.  
  172. Sub Command12_Click ()
  173.     LedDisplay1.Action = 1
  174. End Sub
  175.  
  176. Sub Command13_Click ()
  177.     Dim cState As Integer
  178.  
  179.     cState = LedDisplay1.Italic
  180.     cState = (cState + 1) Mod 2
  181.     LedDisplay1.Italic = cState
  182. End Sub
  183.  
  184. Sub Command2_Click ()
  185.     Dim strState As String
  186.     Dim nState As Integer
  187.  
  188.     strState = "Off"
  189.     nState = LedDisplay1.Mode
  190.     nState = (nState + 1) Mod 2
  191.     
  192.     On Error GoTo BadMode
  193.     LedDisplay1.Mode = nState
  194.     
  195.     ' reset the counter, clear the display
  196.     LedDisplay1.Action = 1
  197.     gCount = 0
  198.  
  199.     If (LedDisplay1.Mode = 1) Then strState = "On"
  200.     Command2.Caption = "Scroll Mode Is " & strState
  201.     Exit Sub
  202.  
  203. BadMode:
  204.     MsgBox "Illegal Mode, Error " & Err
  205.     Resume Next
  206. End Sub
  207.  
  208. Sub Command3_Click ()
  209.     timer1.Interval = 0
  210. End Sub
  211.  
  212. Sub Command4_Click ()
  213.     Dim nState As Integer
  214.  
  215.     nState = LedDisplay1.UnlitSegments
  216.     If (nState) Then nState = 0 Else nState = 1
  217.  
  218.     LedDisplay1.UnlitSegments = nState
  219. End Sub
  220.  
  221. Sub Command5_Click ()
  222.     gCount = 0
  223.     LedDisplay1.Number = gCount
  224. End Sub
  225.  
  226. Sub Command6_Click ()
  227.     Dim nDHt As Integer
  228.  
  229.     nDHt = LedDisplay1.DigitHeight
  230.     LedDisplay1.DigitHeight = (nDHt Mod 100) + 25
  231. End Sub
  232.  
  233. Sub Command7_Click ()
  234.     Dim nDigits As Integer
  235.  
  236.     nDigits = LedDisplay1.Digits
  237.  
  238.     nDigits = ((nDigits - 1) Mod 8) + 2
  239.     LedDisplay1.Digits = nDigits
  240.     Command7.Caption = "Number of Digits-" & nDigits
  241. End Sub
  242.  
  243. Sub Command8_Click ()
  244.     Dim nLZ As Integer
  245.     Dim nDigs As Integer
  246.  
  247.     nDigs = LedDisplay1.Digits + 1
  248.     nLZ = LedDisplay1.LeadingZeros
  249.     nLZ = (nLZ + 1) Mod nDigs
  250.  
  251.     On Error GoTo BadZero
  252.     LedDisplay1.LeadingZeros = nLZ
  253.     Command8.Caption = "Leading Zeros-" & LedDisplay1.LeadingZeros
  254.     Exit Sub
  255.  
  256. BadZero:
  257.     MsgBox "Can't Set Leading Zeroes When Scrolling. Error #" & Err
  258.     Resume Next
  259. End Sub
  260.  
  261. Sub Command9_Click ()
  262.     Dim nState As Integer
  263.  
  264.     nState = LedDisplay1.TextEntry
  265.     nState = (nState + 1) Mod 2
  266.     LedDisplay1.TextEntry = nState
  267. End Sub
  268.  
  269. Sub Form_Load ()
  270.     timer1.Interval = 1000
  271.     Me.Left = (Screen.Width - Me.Width) / 2
  272.     Me.Top = (Screen.Height - Me.Height) / 2
  273.     
  274.     gColor(0) = &HFF00&
  275.     gColor(1) = &HFF0000
  276.     gColor(2) = &HFF&
  277.     gColor(3) = &HFFFF00
  278.     gColor(4) = &HFF00FF
  279.     gColor(5) = &HFF&
  280.     gColor(6) = &HFFFFFF
  281.     gColor(7) = &HFFFF&
  282.     gColor(8) = &H80FF&
  283.     gColor(9) = &HC0C0C0
  284.  
  285. End Sub
  286.  
  287. Sub Timer1_Timer ()
  288.     gCount = gCount + 1
  289.     LedDisplay1.Number = gCount
  290. End Sub
  291.  
  292.