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

  1. VERSION 2.00
  2. Begin Form w_ctdate_demo 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "ctDATE (Monthly Calendar) Demo"
  6.    ClientHeight    =   5550
  7.    ClientLeft      =   570
  8.    ClientTop       =   1335
  9.    ClientWidth     =   8805
  10.    Height          =   6075
  11.    Icon            =   CT_DATE.FRX:0000
  12.    Left            =   510
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MDIChild        =   -1  'True
  16.    ScaleHeight     =   5550
  17.    ScaleWidth      =   8805
  18.    Top             =   870
  19.    Width           =   8925
  20.    Begin TextBox txt_date 
  21.       BackColor       =   &H00FFFFFF&
  22.       FontBold        =   0   'False
  23.       FontItalic      =   0   'False
  24.       FontName        =   "MS Sans Serif"
  25.       FontSize        =   8.25
  26.       FontStrikethru  =   0   'False
  27.       FontUnderline   =   0   'False
  28.       ForeColor       =   &H00000000&
  29.       Height          =   315
  30.       Left            =   5820
  31.       TabIndex        =   18
  32.       Top             =   1380
  33.       Width           =   2355
  34.    End
  35.    Begin ctPUSH ctPush1 
  36.       BackColor       =   &H00C0C0C0&
  37.       BevelSize       =   2
  38.       ButtonHeight    =   25
  39.       ButtonWidth     =   33
  40.       Caption         =   "ctPush1"
  41.       DisableColor    =   &H00808080&
  42.       FocusBorder     =   0   'False
  43.       ForeColor       =   &H00000000&
  44.       Height          =   315
  45.       Left            =   8160
  46.       MultiLine       =   0  'None
  47.       PicBevel        =   1
  48.       PicExpand       =   0   'False
  49.       PicOnly         =   -1  'True
  50.       PicPosition     =   1  'Top
  51.       Picture         =   CT_DATE.FRX:0302
  52.       PicXOffset      =   0
  53.       PicYOffset      =   0
  54.       RepeatRate      =   0
  55.       RoundCorners    =   -1  'True
  56.       State           =   -1  'True
  57.       TabIndex        =   17
  58.       TextXOffset     =   0
  59.       TextYOffset     =   0
  60.       Toggle          =   0   'False
  61.       Top             =   1380
  62.       Width           =   285
  63.    End
  64.    Begin ctDATE ctDate1 
  65.       Action          =   0
  66.       BackColor       =   &H00C0C0C0&
  67.       BorderColor     =   &H00808080&
  68.       BorderStyle     =   1  'Fixed Single
  69.       BorderType      =   2  'Raised
  70.       CustomColor1    =   &H00FFFFFF&
  71.       CustomColor2    =   &H00FFFFFF&
  72.       CustomColor3    =   &H00FFFFFF&
  73.       CustomColor4    =   &H00FFFFFF&
  74.       CustomColor5    =   &H00FFFFFF&
  75.       Date            =   34750
  76.       DateBorder      =   1  'None
  77.       Day             =   20
  78.       DayFirst        =   0  'Sunday
  79.       DayHeader       =   "S,M,T,W,T,F,S"
  80.       FocusColor      =   &H00E0FFFF&
  81.       FocusType       =   3  'Lowered
  82.       ForeColor       =   &H00800000&
  83.       Height          =   2775
  84.       Left            =   5820
  85.       LevelColor      =   &H00808000&
  86.       LevelDepth      =   2  'Header
  87.       LevelOffset     =   0
  88.       Month           =   2
  89.       MonthNames      =   "January,February,March,April,May,June,July,August,September,October,November,December"
  90.       TabIndex        =   16
  91.       TitleAlign      =   3  'Center with Buttons
  92.       TitleBorder     =   0   'False
  93.       TitleColor      =   &H00000000&
  94.       Top             =   1680
  95.       Visible         =   0   'False
  96.       WeekendMark     =   0  'Default
  97.       Width           =   2625
  98.       Year            =   1995
  99.    End
  100.    Begin ctGROUP ctGroup2 
  101.       Alignment       =   0  'Left
  102.       BackColor       =   &H00C0C0C0&
  103.       BorderColor     =   &H00808080&
  104.       BorderType      =   3  'Raised Inset
  105.       Caption         =   "Focus Border"
  106.       ForeColor       =   &H00000000&
  107.       Height          =   1575
  108.       Left            =   3840
  109.       TabIndex        =   13
  110.       TextPosition    =   0  'Top
  111.       Top             =   3180
  112.       Width           =   1635
  113.       Begin ctRADIO ctlw 
  114.          Alignment       =   0  'Left Justify
  115.          BackColor       =   &H00C0C0C0&
  116.          Caption         =   "Lowered"
  117.          DisableColor    =   &H00808080&
  118.          ForeColor       =   &H00000000&
  119.          Height          =   255
  120.          Left            =   180
  121.          PicStyle        =   1  'Style #1
  122.          ShowFocus       =   -1  'True
  123.          TabIndex        =   22
  124.          Top             =   1200
  125.          Value           =   0   'False
  126.          Width           =   1005
  127.       End
  128.       Begin ctRADIO ctraise 
  129.          Alignment       =   0  'Left Justify
  130.          BackColor       =   &H00C0C0C0&
  131.          Caption         =   "Raised"
  132.          DisableColor    =   &H00808080&
  133.          ForeColor       =   &H00000000&
  134.          Height          =   255
  135.          Left            =   180
  136.          PicStyle        =   1  'Style #1
  137.          ShowFocus       =   -1  'True
  138.          TabIndex        =   21
  139.          Top             =   900
  140.          Value           =   0   'False
  141.          Width           =   1185
  142.       End
  143.       Begin ctRADIO ctRadio2 
  144.          Alignment       =   0  'Left Justify
  145.          BackColor       =   &H00C0C0C0&
  146.          Caption         =   "Flat"
  147.          DisableColor    =   &H00808080&
  148.          ForeColor       =   &H00000000&
  149.          Height          =   255
  150.          Left            =   180
  151.          PicStyle        =   1  'Style #1
  152.          ShowFocus       =   -1  'True
  153.          TabIndex        =   15
  154.          Top             =   600
  155.          Value           =   0   'False
  156.          Width           =   1275
  157.       End
  158.       Begin ctRADIO ctRadio1 
  159.          Alignment       =   0  'Left Justify
  160.          BackColor       =   &H00C0C0C0&
  161.          Caption         =   "Regular"
  162.          DisableColor    =   &H00808080&
  163.          ForeColor       =   &H00000000&
  164.          Height          =   255
  165.          Left            =   180
  166.          PicStyle        =   1  'Style #1
  167.          ShowFocus       =   -1  'True
  168.          TabIndex        =   14
  169.          Top             =   300
  170.          Value           =   -1  'True
  171.          Width           =   1275
  172.       End
  173.    End
  174.    Begin ctGROUP ctGroup1 
  175.       Alignment       =   0  'Left
  176.       BackColor       =   &H00C0C0C0&
  177.       BorderColor     =   &H00808080&
  178.       BorderType      =   3  'Raised Inset
  179.       Caption         =   "Date Border"
  180.       ForeColor       =   &H00000000&
  181.       Height          =   1575
  182.       Left            =   3840
  183.       TabIndex        =   8
  184.       TextPosition    =   0  'Top
  185.       Top             =   1500
  186.       Width           =   1635
  187.       Begin ctRADIO ctRadio4 
  188.          Alignment       =   0  'Left Justify
  189.          BackColor       =   &H00C0C0C0&
  190.          Caption         =   "Lowered"
  191.          DisableColor    =   &H00808080&
  192.          ForeColor       =   &H00000000&
  193.          Height          =   255
  194.          Left            =   180
  195.          PicStyle        =   1  'Style #1
  196.          ShowFocus       =   -1  'True
  197.          TabIndex        =   12
  198.          Top             =   1200
  199.          Value           =   -1  'True
  200.          Width           =   1245
  201.       End
  202.       Begin ctRADIO ctRadio3 
  203.          Alignment       =   0  'Left Justify
  204.          BackColor       =   &H00C0C0C0&
  205.          Caption         =   "Raised"
  206.          DisableColor    =   &H00808080&
  207.          ForeColor       =   &H00000000&
  208.          Height          =   255
  209.          Left            =   180
  210.          PicStyle        =   1  'Style #1
  211.          ShowFocus       =   -1  'True
  212.          TabIndex        =   11
  213.          Top             =   900
  214.          Value           =   0   'False
  215.          Width           =   1065
  216.       End
  217.       Begin ctRADIO rb_none 
  218.          Alignment       =   0  'Left Justify
  219.          BackColor       =   &H00C0C0C0&
  220.          Caption         =   "None"
  221.          DisableColor    =   &H00808080&
  222.          ForeColor       =   &H00000000&
  223.          Height          =   255
  224.          Left            =   180
  225.          PicStyle        =   1  'Style #1
  226.          ShowFocus       =   -1  'True
  227.          TabIndex        =   10
  228.          Top             =   600
  229.          Value           =   0   'False
  230.          Width           =   1095
  231.       End
  232.       Begin ctRADIO rb_regular 
  233.          Alignment       =   0  'Left Justify
  234.          BackColor       =   &H00C0C0C0&
  235.          Caption         =   "Regular"
  236.          DisableColor    =   &H00808080&
  237.          ForeColor       =   &H00000000&
  238.          Height          =   255
  239.          Left            =   180
  240.          PicStyle        =   1  'Style #1
  241.          ShowFocus       =   -1  'True
  242.          TabIndex        =   9
  243.          Top             =   300
  244.          Value           =   0   'False
  245.          Width           =   1215
  246.       End
  247.    End
  248.    Begin CommandButton Command2 
  249.       Caption         =   "Today"
  250.       Height          =   375
  251.       Left            =   1440
  252.       TabIndex        =   5
  253.       Top             =   4980
  254.       Width           =   945
  255.    End
  256.    Begin ctDATA date_next 
  257.       AmountButtons   =   1  'Three Buttons
  258.       ArrowColor      =   &H00000000&
  259.       ArrowSize       =   1  'Large
  260.       BevelSize       =   2
  261.       BorderColor     =   &H00000000&
  262.       DisableCenter   =   0   'False
  263.       DisableLeft     =   0   'False
  264.       DisableRight    =   0   'False
  265.       Height          =   375
  266.       Left            =   2370
  267.       RepeatCenter    =   -1  'True
  268.       RepeatLeft      =   -1  'True
  269.       RepeatRate      =   5
  270.       RepeatRight     =   -1  'True
  271.       SkipValue       =   1
  272.       Style           =   1  'Next Records
  273.       TabIndex        =   4
  274.       Top             =   4980
  275.       Width           =   1095
  276.    End
  277.    Begin ctDATA date_prev 
  278.       AmountButtons   =   1  'Three Buttons
  279.       ArrowColor      =   &H00000000&
  280.       ArrowSize       =   1  'Large
  281.       BevelSize       =   2
  282.       BorderColor     =   &H00000000&
  283.       DisableCenter   =   0   'False
  284.       DisableLeft     =   0   'False
  285.       DisableRight    =   0   'False
  286.       Height          =   375
  287.       Left            =   360
  288.       RepeatCenter    =   -1  'True
  289.       RepeatLeft      =   -1  'True
  290.       RepeatRate      =   5
  291.       RepeatRight     =   -1  'True
  292.       SkipValue       =   1
  293.       Style           =   0  'Previous Records
  294.       TabIndex        =   3
  295.       Top             =   4980
  296.       Width           =   1095
  297.    End
  298.    Begin CommandButton Command1 
  299.       Caption         =   "Exit"
  300.       Height          =   375
  301.       Left            =   4320
  302.       TabIndex        =   1
  303.       Top             =   5040
  304.       Width           =   795
  305.    End
  306.    Begin ctDATE ctDate 
  307.       Action          =   0
  308.       BackColor       =   &H00C0C0C0&
  309.       BorderColor     =   &H00808080&
  310.       BorderStyle     =   1  'Fixed Single
  311.       BorderType      =   2  'Raised
  312.       CustomColor1    =   &H00FFFF00&
  313.       CustomColor2    =   &H0000FF00&
  314.       CustomColor3    =   &H0000FFFF&
  315.       CustomColor4    =   &H00FF00FF&
  316.       CustomColor5    =   &H00FFFFFF&
  317.       Date            =   34667
  318.       DateBorder      =   3  'Lowered
  319.       Day             =   29
  320.       DayFirst        =   0  'Sunday
  321.       DayHeader       =   "S,M,T,W,T,F,S"
  322.       FocusColor      =   &H000000FF&
  323.       FocusType       =   0  'Regular
  324.       ForeColor       =   &H00000000&
  325.       Height          =   3315
  326.       Left            =   360
  327.       LevelColor      =   &H00808080&
  328.       LevelDepth      =   0  'None
  329.       LevelOffset     =   0
  330.       Month           =   11
  331.       MonthNames      =   "January,February,March,April,May,June,July,August,September,October,November,December"
  332.       TabIndex        =   0
  333.       TitleAlign      =   2  'Center
  334.       TitleBorder     =   -1  'True
  335.       TitleColor      =   &H00800000&
  336.       Top             =   1440
  337.       WeekendMark     =   1  'Custom Color #1
  338.       Width           =   3135
  339.       Year            =   1994
  340.    End
  341.    Begin Label lbl_move 
  342.       Alignment       =   2  'Center
  343.       BackColor       =   &H00C0C0C0&
  344.       Caption         =   "Click on the arrows beside the title to move to a different month."
  345.       FontBold        =   0   'False
  346.       FontItalic      =   0   'False
  347.       FontName        =   "MS Sans Serif"
  348.       FontSize        =   9.75
  349.       FontStrikethru  =   0   'False
  350.       FontUnderline   =   0   'False
  351.       ForeColor       =   &H00800000&
  352.       Height          =   675
  353.       Left            =   6090
  354.       TabIndex        =   20
  355.       Top             =   4500
  356.       Visible         =   0   'False
  357.       Width           =   2145
  358.    End
  359.    Begin Label Label3 
  360.       Alignment       =   2  'Center
  361.       BackStyle       =   0  'Transparent
  362.       Caption         =   "The example above uses a label control, picture push button, and a calendar control to simulate a drop down calendar box. Press the button to view the calendar"
  363.       FontBold        =   0   'False
  364.       FontItalic      =   0   'False
  365.       FontName        =   "MS Sans Serif"
  366.       FontSize        =   9.75
  367.       FontStrikethru  =   0   'False
  368.       FontUnderline   =   0   'False
  369.       ForeColor       =   &H00800000&
  370.       Height          =   2175
  371.       Left            =   6060
  372.       TabIndex        =   19
  373.       Top             =   2100
  374.       Width           =   2205
  375.    End
  376.    Begin Label sle_date 
  377.       BackColor       =   &H00FFFFFF&
  378.       BorderStyle     =   1  'Fixed Single
  379.       FontBold        =   0   'False
  380.       FontItalic      =   0   'False
  381.       FontName        =   "MS Sans Serif"
  382.       FontSize        =   8.25
  383.       FontStrikethru  =   0   'False
  384.       FontUnderline   =   0   'False
  385.       Height          =   315
  386.       Left            =   1800
  387.       TabIndex        =   7
  388.       Top             =   1080
  389.       Width           =   2475
  390.    End
  391.    Begin Label Label2 
  392.       BackColor       =   &H00C0C0C0&
  393.       Caption         =   "Date Selected :"
  394.       FontBold        =   0   'False
  395.       FontItalic      =   0   'False
  396.       FontName        =   "MS Sans Serif"
  397.       FontSize        =   9.75
  398.       FontStrikethru  =   0   'False
  399.       FontUnderline   =   0   'False
  400.       Height          =   315
  401.       Left            =   360
  402.       TabIndex        =   6
  403.       Top             =   1080
  404.       Width           =   1455
  405.    End
  406.    Begin Label Label1 
  407.       Alignment       =   2  'Center
  408.       BackColor       =   &H00C0C0C0&
  409.       Caption         =   "ctDATE VBX Is a Calendar Control that allows you to display and select dates in a visual format. The calendar works from 1900 on. Up to five different custom colors can be used to mark the dates. Differnt months or years can be viewed either through an Action attribute of the control, or by using internal controls."
  410.       ForeColor       =   &H00800000&
  411.       Height          =   795
  412.       Left            =   270
  413.       TabIndex        =   2
  414.       Top             =   120
  415.       Width           =   8235
  416.    End
  417. Sub Command1_Click ()
  418.    Unload w_ctdate_demo
  419. End Sub
  420. Sub Command2_Click ()
  421.    ctDate.Action = 7
  422. End Sub
  423. Sub ctDate_DateChange (nDow As Integer, nDay As Integer, nMonth As Integer, nYear As Integer)
  424. Dim MonthName As String
  425. If (nMonth = 1) Then
  426.    ctDate.MarkDate(1) = 2
  427. ElseIf (nMonth = 2) Then
  428.    ctDate.MarkDate(14) = 4
  429. ElseIf (nMonth = 4) Then
  430.    ctDate.MarkDate(14) = 2
  431. ElseIf (nMonth = 5) Then
  432.    ctDate.MarkDate(22) = 2
  433. ElseIf (nMonth = 7) Then
  434.    ctDate.MarkDate(1) = 2
  435.    ctDate.MarkDate(4) = 2
  436. ElseIf (nMonth = 9) Then
  437.    ctDate.MarkDate(9) = 2
  438. ElseIf (nMonth = 10) Then
  439.    ctDate.MarkDate(4) = 2
  440. ElseIf (nMonth = 11) Then
  441.    ctDate.MarkDate(11) = 2
  442. ElseIf (nMonth = 12) Then
  443.    ctDate.MarkDate(24) = 3
  444.    ctDate.MarkDate(25) = 2
  445.    ctDate.MarkDate(26) = 3
  446. End If
  447. If (nMonth = 1) Then
  448.    MonthName = "Jan."
  449. ElseIf (nMonth = 2) Then
  450.    MonthName = "Feb."
  451. ElseIf (nMonth = 3) Then
  452.    MonthName = "Mar."
  453. ElseIf (nMonth = 4) Then
  454.    MonthName = "Apr."
  455. ElseIf (nMonth = 5) Then
  456.    MonthName = "May"
  457. ElseIf (nMonth = 6) Then
  458.    MonthName = "June"
  459. ElseIf (nMonth = 7) Then
  460.    MonthName = "July"
  461. ElseIf (nMonth = 8) Then
  462.    MonthName = "Aug."
  463. ElseIf (nMonth = 9) Then
  464.    MonthName = "Sep."
  465. ElseIf (nMonth = 10) Then
  466.    MonthName = "Oct."
  467. ElseIf (nMonth = 11) Then
  468.    MonthName = "Nov."
  469. ElseIf (nMonth = 12) Then
  470.    MonthName = "Dec."
  471.    MonthName = "???"
  472. End If
  473. MonthName = MonthName + " " + Str$(nDay) + " / " + Str$(nYear)
  474. If (nDow = 1) Then
  475.    sle_date.Caption = "Sunday " + MonthName
  476. ElseIf (nDow = 2) Then
  477.    sle_date.Caption = "Monday " + MonthName
  478. ElseIf (nDow = 3) Then
  479.    sle_date.Caption = "Tuesday " + MonthName
  480. ElseIf (nDow = 4) Then
  481.    sle_date.Caption = "Wednesday " + MonthName
  482. ElseIf (nDow = 5) Then
  483.    sle_date.Caption = "Thursday " + MonthName
  484. ElseIf (nDow = 6) Then
  485.    sle_date.Caption = "Friday " + MonthName
  486. ElseIf (nDow = 7) Then
  487.    sle_date.Caption = "Saturday " + MonthName
  488. End If
  489. End Sub
  490. Sub ctDate1_DateChange (nDow As Integer, nDay As Integer, nMonth As Integer, nYear As Integer)
  491.    Dim MonthName As String
  492.    If (nMonth = 1) Then
  493.       MonthName = "January"
  494.    ElseIf (nMonth = 2) Then
  495.       MonthName = "February"
  496.    ElseIf (nMonth = 3) Then
  497.       MonthName = "March"
  498.    ElseIf (nMonth = 4) Then
  499.       MonthName = "April"
  500.    ElseIf (nMonth = 5) Then
  501.       MonthName = "May"
  502.    ElseIf (nMonth = 6) Then
  503.       MonthName = "June"
  504.    ElseIf (nMonth = 7) Then
  505.       MonthName = "July"
  506.    ElseIf (nMonth = 8) Then
  507.       MonthName = "August"
  508.    ElseIf (nMonth = 9) Then
  509.       MonthName = "September"
  510.    ElseIf (nMonth = 10) Then
  511.       MonthName = "October"
  512.    ElseIf (nMonth = 11) Then
  513.       MonthName = "November"
  514.    ElseIf (nMonth = 12) Then
  515.       MonthName = "December"
  516.    Else
  517.       MonthName = "???"
  518.    End If
  519.    MonthName = MonthName + " " + Str$(nDay) + " / " + Str$(nYear)
  520.    txt_date.Text = MonthName
  521. End Sub
  522. Sub ctDate1_LostFocus ()
  523.    lbl_move.Visible = False
  524.    ctDate1.Visible = False
  525. End Sub
  526. Sub ctlw_Click ()
  527.    ctDate.FocusType = 3
  528. End Sub
  529. Sub ctPush1_Click ()
  530.    lbl_move.Visible = True
  531.    ctDate1.Visible = True
  532.    ctDate1.SetFocus
  533. End Sub
  534. Sub ctRadio1_Click ()
  535.    ctDate.FocusType = 0
  536. End Sub
  537. Sub ctRadio2_Click ()
  538.    ctDate.FocusType = 1
  539. End Sub
  540. Sub ctRadio3_Click ()
  541.    ctDate.DateBorder = 2
  542. End Sub
  543. Sub ctRadio4_Click ()
  544.    ctDate.DateBorder = 3
  545. End Sub
  546. Sub ctraise_Click ()
  547.    ctDate.FocusType = 2
  548. End Sub
  549. Sub date_next_ClickCenter ()
  550.    ctDate.Action = 2
  551. End Sub
  552. Sub date_next_ClickLeft ()
  553.    ctDate.Action = 1
  554. End Sub
  555. Sub date_next_ClickRight ()
  556.    ctDate.Action = 3
  557. End Sub
  558. Sub date_prev_ClickCenter ()
  559.    ctDate.Action = 5
  560. End Sub
  561. Sub date_prev_ClickLeft ()
  562.    ctDate.Action = 6
  563. End Sub
  564. Sub date_prev_ClickRight ()
  565.    ctDate.Action = 4
  566. End Sub
  567. Sub Form_Load ()
  568.    ' Center the window on the screen
  569.    Move (Screen.Width - Width) / 2, (Screen.Height - Height) * .15
  570.    w_mdi_main.bt_date = BUTTON_DISABLE
  571.    ctDate.Action = 7
  572.    ctDate1.Action = 7
  573. End Sub
  574. Sub Form_Unload (Cancel As Integer)
  575.    w_mdi_main.bt_date = BUTTON_UP
  576. End Sub
  577. Sub rb_none_Click ()
  578.    ctDate.DateBorder = 1
  579. End Sub
  580. Sub rb_regular_Click ()
  581.    ctDate.DateBorder = 0
  582. End Sub
  583.