home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / tool / various / ctdemo / ct_data.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-02-26  |  14.4 KB  |  456 lines

  1. VERSION 2.00
  2. Begin Form w_data_demo 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "ctDATA and ctSPIN (Navigation and Spin Buttons) Demo"
  6.    ClientHeight    =   5475
  7.    ClientLeft      =   450
  8.    ClientTop       =   1290
  9.    ClientWidth     =   8595
  10.    Height          =   6000
  11.    Icon            =   CT_DATA.FRX:0000
  12.    Left            =   390
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MDIChild        =   -1  'True
  16.    ScaleHeight     =   5475
  17.    ScaleWidth      =   8595
  18.    Top             =   825
  19.    Width           =   8715
  20.    Begin HScrollBar hbar 
  21.       Height          =   255
  22.       Left            =   5520
  23.       Max             =   100
  24.       TabIndex        =   18
  25.       Top             =   3660
  26.       Width           =   2445
  27.    End
  28.    Begin TextBox TextSpin 
  29.       Height          =   375
  30.       Left            =   7110
  31.       TabIndex        =   14
  32.       Text            =   "0"
  33.       Top             =   1440
  34.       Width           =   585
  35.    End
  36.    Begin ctSPIN ctSpin3 
  37.       ArrowColor      =   &H00000000&
  38.       ArrowSize       =   0  'Small
  39.       BackColor       =   &H00C0C0C0&
  40.       BevelSize       =   2
  41.       BorderColor     =   &H00000000&
  42.       DisableColor    =   &H00808080&
  43.       Height          =   375
  44.       InitialDelay    =   200
  45.       Left            =   7680
  46.       RepeatRate      =   100
  47.       SpinStyle       =   0  'Vertical
  48.       TabIndex        =   13
  49.       Top             =   1440
  50.       Width           =   255
  51.    End
  52.    Begin ctSPIN ctSpin2 
  53.       ArrowColor      =   &H00000000&
  54.       ArrowSize       =   0  'Small
  55.       BackColor       =   &H00C0C0C0&
  56.       BevelSize       =   2
  57.       BorderColor     =   &H00000000&
  58.       DisableColor    =   &H00808080&
  59.       Height          =   345
  60.       InitialDelay    =   200
  61.       Left            =   6450
  62.       RepeatRate      =   100
  63.       SpinStyle       =   1  'Horizontal
  64.       TabIndex        =   12
  65.       Top             =   4020
  66.       Width           =   825
  67.    End
  68.    Begin ctSPIN ctSpin1 
  69.       ArrowColor      =   &H00000000&
  70.       ArrowSize       =   0  'Small
  71.       BackColor       =   &H00C0C0C0&
  72.       BevelSize       =   2
  73.       BorderColor     =   &H00000000&
  74.       DisableColor    =   &H00808080&
  75.       Height          =   495
  76.       InitialDelay    =   200
  77.       Left            =   7650
  78.       RepeatRate      =   4
  79.       SpinStyle       =   0  'Vertical
  80.       TabIndex        =   11
  81.       Top             =   2460
  82.       Width           =   315
  83.    End
  84.    Begin CommandButton Command1 
  85.       Caption         =   "E&xit"
  86.       Height          =   405
  87.       Left            =   7590
  88.       TabIndex        =   9
  89.       Top             =   4800
  90.       Width           =   795
  91.    End
  92.    Begin TextBox Text2 
  93.       FontBold        =   0   'False
  94.       FontItalic      =   0   'False
  95.       FontName        =   "MS Sans Serif"
  96.       FontSize        =   8.25
  97.       FontStrikethru  =   0   'False
  98.       FontUnderline   =   0   'False
  99.       Height          =   345
  100.       Left            =   1530
  101.       TabIndex        =   7
  102.       Text            =   "Address #1"
  103.       Top             =   2430
  104.       Width           =   2235
  105.    End
  106.    Begin TextBox Text1 
  107.       FontBold        =   0   'False
  108.       FontItalic      =   0   'False
  109.       FontName        =   "MS Sans Serif"
  110.       FontSize        =   8.25
  111.       FontStrikethru  =   0   'False
  112.       FontUnderline   =   0   'False
  113.       Height          =   375
  114.       Left            =   1530
  115.       TabIndex        =   6
  116.       Text            =   "Name #1"
  117.       Top             =   1860
  118.       Width           =   2235
  119.    End
  120.    Begin ctDATA ctData2 
  121.       AmountButtons   =   1  'Three Buttons
  122.       ArrowColor      =   &H00000000&
  123.       ArrowSize       =   1  'Large
  124.       BevelSize       =   2
  125.       BorderColor     =   &H00000000&
  126.       DisableCenter   =   0   'False
  127.       DisableLeft     =   0   'False
  128.       DisableRight    =   0   'False
  129.       Height          =   345
  130.       Left            =   3750
  131.       RepeatCenter    =   -1  'True
  132.       RepeatLeft      =   -1  'True
  133.       RepeatRate      =   5
  134.       RepeatRight     =   -1  'True
  135.       SkipValue       =   1
  136.       Style           =   1  'Next Records
  137.       TabIndex        =   2
  138.       Top             =   3360
  139.       Width           =   1005
  140.    End
  141.    Begin ctDATA ctData1 
  142.       AmountButtons   =   1  'Three Buttons
  143.       ArrowColor      =   &H00000000&
  144.       ArrowSize       =   1  'Large
  145.       BevelSize       =   2
  146.       BorderColor     =   &H00000000&
  147.       DisableCenter   =   0   'False
  148.       DisableLeft     =   0   'False
  149.       DisableRight    =   0   'False
  150.       Height          =   345
  151.       Left            =   270
  152.       RepeatCenter    =   -1  'True
  153.       RepeatLeft      =   -1  'True
  154.       RepeatRate      =   5
  155.       RepeatRight     =   -1  'True
  156.       SkipValue       =   1
  157.       Style           =   0  'Previous Records
  158.       TabIndex        =   1
  159.       Top             =   3360
  160.       Width           =   1005
  161.    End
  162.    Begin ctTEXT ctText 
  163.       Alignment       =   0  'Left Justified
  164.       BackColor       =   &H00FFFFFF&
  165.       BorderColor     =   &H00000000&
  166.       BorderType      =   0  'Regular
  167.       FontBold        =   0   'False
  168.       FontItalic      =   0   'False
  169.       FontName        =   "MS Sans Serif"
  170.       FontSize        =   8.25
  171.       FontStrikethru  =   0   'False
  172.       FontUnderline   =   0   'False
  173.       ForeColor       =   &H00000000&
  174.       Height          =   345
  175.       Left            =   1230
  176.       PicPosition     =   0  'Center
  177.       ShadowColor     =   &H00000000&
  178.       SingleLine      =   -1  'True
  179.       TabIndex        =   8
  180.       TextAngle       =   0
  181.       TextPosition    =   0  'Top
  182.       ThreeDColor     =   &H00808080&
  183.       ThreeDText      =   0   'False
  184.       Top             =   3360
  185.       Width           =   2535
  186.    End
  187.    Begin Label Label8 
  188.       BackStyle       =   0  'Transparent
  189.       Caption         =   "Horizontal Setting"
  190.       FontBold        =   0   'False
  191.       FontItalic      =   0   'False
  192.       FontName        =   "MS Sans Serif"
  193.       FontSize        =   8.25
  194.       FontStrikethru  =   0   'False
  195.       FontUnderline   =   0   'False
  196.       ForeColor       =   &H00000000&
  197.       Height          =   255
  198.       Left            =   5520
  199.       TabIndex        =   19
  200.       Top             =   3360
  201.       Width           =   1815
  202.    End
  203.    Begin Label Label6 
  204.       BackStyle       =   0  'Transparent
  205.       Caption         =   "Character Arrays"
  206.       FontBold        =   0   'False
  207.       FontItalic      =   0   'False
  208.       FontName        =   "MS Sans Serif"
  209.       FontSize        =   8.25
  210.       FontStrikethru  =   0   'False
  211.       FontUnderline   =   0   'False
  212.       ForeColor       =   &H00000000&
  213.       Height          =   255
  214.       Left            =   5430
  215.       TabIndex        =   17
  216.       Top             =   2220
  217.       Width           =   1305
  218.    End
  219.    Begin Label Label7 
  220.       BackStyle       =   0  'Transparent
  221.       Caption         =   "Spin button with a numeric value"
  222.       FontBold        =   0   'False
  223.       FontItalic      =   0   'False
  224.       FontName        =   "MS Sans Serif"
  225.       FontSize        =   8.25
  226.       FontStrikethru  =   0   'False
  227.       FontUnderline   =   0   'False
  228.       ForeColor       =   &H00000000&
  229.       Height          =   435
  230.       Left            =   5640
  231.       TabIndex        =   16
  232.       Top             =   1440
  233.       Width           =   1395
  234.    End
  235.    Begin Label lbl_string 
  236.       Alignment       =   2  'Center
  237.       BorderStyle     =   1  'Fixed Single
  238.       Caption         =   "Stop Sign"
  239.       FontBold        =   0   'False
  240.       FontItalic      =   0   'False
  241.       FontName        =   "MS Sans Serif"
  242.       FontSize        =   13.5
  243.       FontStrikethru  =   0   'False
  244.       FontUnderline   =   0   'False
  245.       Height          =   495
  246.       Left            =   5430
  247.       TabIndex        =   15
  248.       Top             =   2460
  249.       Width           =   2235
  250.    End
  251.    Begin Label Label5 
  252.       Alignment       =   2  'Center
  253.       BackColor       =   &H00C0C0C0&
  254.       Caption         =   "The following example shows how two data controls and a label control can be set up to move through a database. Each one of the buttons has a repeating action so that continuing to press a button will continue to move through the database records."
  255.       FontBold        =   0   'False
  256.       FontItalic      =   0   'False
  257.       FontName        =   "MS Sans Serif"
  258.       FontSize        =   8.25
  259.       FontStrikethru  =   0   'False
  260.       FontUnderline   =   0   'False
  261.       ForeColor       =   &H00000000&
  262.       Height          =   1095
  263.       Left            =   330
  264.       TabIndex        =   10
  265.       Top             =   4140
  266.       Width           =   4245
  267.    End
  268.    Begin Label Label4 
  269.       Alignment       =   1  'Right Justify
  270.       BackColor       =   &H00C0C0C0&
  271.       Caption         =   "Address : "
  272.       ForeColor       =   &H00000000&
  273.       Height          =   345
  274.       Left            =   450
  275.       TabIndex        =   5
  276.       Top             =   2460
  277.       Width           =   975
  278.    End
  279.    Begin Label Label3 
  280.       Alignment       =   1  'Right Justify
  281.       BackColor       =   &H00C0C0C0&
  282.       Caption         =   "Name : "
  283.       ForeColor       =   &H00000000&
  284.       Height          =   315
  285.       Left            =   570
  286.       TabIndex        =   4
  287.       Top             =   1890
  288.       Width           =   855
  289.    End
  290.    Begin Label Label2 
  291.       Alignment       =   2  'Center
  292.       BackColor       =   &H00C0C0C0&
  293.       Caption         =   "Click on any of the buttons"
  294.       FontBold        =   0   'False
  295.       FontItalic      =   0   'False
  296.       FontName        =   "MS Sans Serif"
  297.       FontSize        =   8.25
  298.       FontStrikethru  =   0   'False
  299.       FontUnderline   =   0   'False
  300.       ForeColor       =   &H00800000&
  301.       Height          =   285
  302.       Left            =   1230
  303.       TabIndex        =   3
  304.       Top             =   3780
  305.       Width           =   2295
  306.    End
  307.    Begin Shape Shape1 
  308.       Height          =   1665
  309.       Left            =   330
  310.       Top             =   1440
  311.       Width           =   4095
  312.    End
  313.    Begin Label Label1 
  314.       Alignment       =   2  'Center
  315.       BackColor       =   &H00C0C0C0&
  316.       Caption         =   "The following demo demonstrates two differnt types of push buttons. ctDATA VBX control is a type of button that can be used to assist the user to navigate through data or pages of data. The control can be set up either with two or three buttons and a user defined bitmap or icon can be substituted for any of the arrows. The ctSPIN control is a simple spin control button that can be set up in a horizontal or vertical manner."
  317.       ForeColor       =   &H00800000&
  318.       Height          =   1035
  319.       Left            =   330
  320.       TabIndex        =   0
  321.       Top             =   180
  322.       Width           =   7905
  323.    End
  324. Dim nRecord As Integer
  325. Dim nBevel As Integer
  326. Dim nArray As Integer
  327. Dim cString(12) As String
  328. Sub Command1_Click ()
  329.    Unload w_data_demo
  330. End Sub
  331. Sub ctData1_ClickCenter ()
  332.    If (nRecord > 10) Then
  333.       nRecord = nRecord - 10
  334.    Else
  335.       nRecord = 0
  336.    End If
  337.    Text1.Text = "Name #" + Str(nRecord)
  338.    Text2.Text = "Address #" + Str(nRecord)
  339. End Sub
  340. Sub ctData1_ClickLeft ()
  341.    If (nRecord > 1) Then
  342.       nRecord = 1
  343.    End If
  344.    Text1.Text = "Name #" + Str(nRecord)
  345.    Text2.Text = "Address #" + Str(nRecord)
  346. End Sub
  347. Sub ctData1_ClickRight ()
  348.    If (nRecord > 1) Then
  349.       nRecord = nRecord - 1
  350.    End If
  351.    Text1.Text = "Name #" + Str(nRecord)
  352.    Text2.Text = "Address #" + Str(nRecord)
  353. End Sub
  354. Sub ctData1_MouseCenter ()
  355.    ctText.Caption = "Skip to Previous Page of Records"
  356. End Sub
  357. Sub ctData1_MouseLeft ()
  358.    ctText.Caption = "Skip to First Record"
  359. End Sub
  360. Sub ctData1_MouseRight ()
  361.    ctText.Caption = "Skip Backward One Record"
  362. End Sub
  363. Sub ctData2_ClickCenter ()
  364.    If (nRecord < 100) Then
  365.       nRecord = nRecord + 10
  366.    End If
  367.    Text1.Text = "Name #" + Str(nRecord)
  368.    Text2.Text = "Address #" + Str(nRecord)
  369. End Sub
  370. Sub ctData2_ClickLeft ()
  371.    If (nRecord < 100) Then
  372.       nRecord = nRecord + 1
  373.    End If
  374.    Text1.Text = "Name #" + Str(nRecord)
  375.    Text2.Text = "Address #" + Str(nRecord)
  376. End Sub
  377. Sub ctData2_ClickRight ()
  378.    If (nRecord < 100) Then
  379.       nRecord = 100
  380.    End If
  381.    Text1.Text = "Name #" + Str(nRecord)
  382.    Text2.Text = "Address #" + Str(nRecord)
  383. End Sub
  384. Sub ctData2_MouseCenter ()
  385.    ctText.Caption = "Skip forward a Page of Records"
  386. End Sub
  387. Sub ctData2_MouseLeft ()
  388.    ctText.Caption = "Skip forward One Record"
  389. End Sub
  390. Sub ctData2_MouseRight ()
  391.    ctText.Caption = "Skip to the Last Record"
  392. End Sub
  393. Sub ctSpin1_Click (nButton As Integer)
  394.    If (nButton = 1) Then
  395.       nArray = Minimum(nArray + 1, 12)
  396.    Else
  397.       nArray = Maximum(nArray - 1, 1)
  398.    End If
  399.    lbl_string.Caption = cString(nArray)
  400. End Sub
  401. Sub ctSpin2_Click (nButton As Integer)
  402.    If (nButton = 1) Then
  403.       hbar.Value = Maximum(hbar.Value - 1, 0)
  404.    Else
  405.       hbar.Value = Minimum(hbar.Value + 1, 100)
  406.    End If
  407. End Sub
  408. Sub ctSpin3_Click (nButton As Integer)
  409.    If (nButton = 1) Then
  410.       nBevel = Minimum(nBevel + 1, 15)
  411.    Else
  412.       nBevel = Maximum(nBevel - 1, 0)
  413.    End If
  414.    TextSpin.Text = LTrim(Str(nBevel))
  415. End Sub
  416. Sub Form_Load ()
  417.    ' Center the window on the screen
  418.    Move (Screen.Width - Width) / 2, (Screen.Height - Height) * .25
  419.    w_mdi_main.bt_data = BUTTON_DISABLE
  420.    nRecord = 1
  421.    nBevel = 1
  422.    nArray = 1
  423.    cString(1) = "Stop Sign"
  424.    cString(2) = "Happy Face"
  425.    cString(3) = "Empty Diamond"
  426.    cString(4) = "Blue Diamond"
  427.    cString(5) = "Empty Box"
  428.    cString(6) = "Cross Box"
  429.    cString(7) = "Green Start"
  430.    cString(8) = "Previous Page"
  431.    cString(9) = "Last Record"
  432.    cString(10) = "Next Record"
  433.    cString(11) = "Next Page"
  434.    cString(12) = "Green End"
  435. End Sub
  436. Sub Form_MouseMove (Button As Integer, Shift As Integer, x As Single, y As Single)
  437.    ctText.Caption = ""
  438. End Sub
  439. Sub Form_Unload (Cancel As Integer)
  440.    w_mdi_main.bt_data = BUTTON_UP
  441. End Sub
  442. Function Maximum (x As Integer, y As Integer)
  443.    If x > y Then
  444.       Maximum = x
  445.    Else
  446.       Maximum = y
  447.    End If
  448. End Function
  449. Function Minimum (x As Integer, y As Integer)
  450.    If x < y Then
  451.       Minimum = x
  452.    Else
  453.       Minimum = y
  454.    End If
  455. End Function
  456.