home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code2 / t_bar / mdiform1.frm < prev    next >
Text File  |  1994-06-11  |  6KB  |  212 lines

  1. VERSION 2.00
  2. Begin MDIForm MDIForm1 
  3.    Caption         =   "TBar Demo"
  4.    ClientHeight    =   3024
  5.    ClientLeft      =   144
  6.    ClientTop       =   828
  7.    ClientWidth     =   6528
  8.    Height          =   3768
  9.    Left            =   96
  10.    LinkTopic       =   "MDIForm1"
  11.    Top             =   132
  12.    Width           =   6624
  13.    Begin PictureBox Picture1 
  14.       Align           =   2  'Align Bottom
  15.       BackColor       =   &H00C0C0C0&
  16.       Height          =   384
  17.       Left            =   0
  18.       ScaleHeight     =   360
  19.       ScaleWidth      =   6504
  20.       TabIndex        =   0
  21.       Top             =   2640
  22.       Width           =   6528
  23.       Begin Label Label1 
  24.          BackColor       =   &H00C0C0C0&
  25.          Caption         =   "No Mouse Events Received Yet!"
  26.          Height          =   252
  27.          Left            =   96
  28.          TabIndex        =   1
  29.          Top             =   48
  30.          Width           =   7548
  31.       End
  32.    End
  33.    Begin TBar TBar1 
  34.       Align           =   1  'Align Top
  35.       AutoPlacement   =   0   'False
  36.       BackColor       =   &H00C0C0C0&
  37.       BevelWidth      =   2
  38.       Bitmap          =   MDIFORM1.FRX:0000
  39.       ButtonHeight    =   15      ButtonVisible   =   ""
  40.       ButtonWidth     =   16      Disabled        =   ";;;1;1;1"
  41.       EnableHelp      =   -1  'True
  42.       ForeColor       =   &H00000000&
  43.       Gap             =   "0;;8;;;8;8"
  44.       Group           =   "None;;;;;;None;8,9;7,9;7,8"
  45.       Height          =   348
  46.       HelpBackColor   =   &H0080FFFF&
  47.       HelpForeColor   =   &H00000000&
  48.       HelpInterval    =   1000
  49.       HelpPosition    =   0  'Below Cursor
  50.       HelpQuickInterval=   250
  51.       HelpStyle       =   0  'Box
  52.       HelpText        =   "Help Button 1\rLIne 2;Help Button 2;Help Button 3;Help Button 4;Help Button 5;Help Button 6;Help Button 7;Help Button 8;Help Button 9;Help Button 10"
  53.       Interval        =   0
  54.       LeadingInterval =   10
  55.       Left            =   0
  56.       Outline         =   -1  'True
  57.       OutlineColor    =   &H00000000&
  58.       PressedBevelWidth=   1
  59.       RoundedCorners  =   -1  'True
  60.       Sticky          =   "0;;;;;;1;1;1;1"
  61.       ToolbarStyle    =   0  'Horizontal
  62.       Top             =   0
  63.       Version         =   "02.30"
  64.       VisibileButtons =   10
  65.       Width           =   6528
  66.    End
  67.    Begin Menu mnuFile 
  68.       Caption         =   "&File"
  69.       Begin Menu mnuTest 
  70.          Caption         =   "&Test"
  71.       End
  72.    End
  73. End
  74. Const BS_IS_TOGGLED = 1
  75. Const BS_IS_ENABLED = 2
  76. Const BS_IS_NOTTOGGLED = 3
  77. Const BS_IS_NOTENABLED = 4
  78. Const BS_IS_VISIBLE = 5
  79. Const BS_IS_INVISIBLE = 6
  80.  
  81. Sub MDIForm_Load ()
  82.  
  83.   ' TBar1.Id(0) = 1
  84.   ' TBar1.Id(1) = 0
  85.  
  86.   TBar1.ButtonState(4) = BS_IS_ENABLED
  87.   TBar1.ButtonState(0) = BS_IS_NOTENABLED
  88.  
  89.   TBar1.ButtonState(7) = BS_IS_TOGGLED
  90.   ' TBar1.ButtonState(6) = BS_IS_TOGGLED
  91.   ' TBar1.ButtonState(6) = BS_IS_NOTTOGGLED
  92.  
  93.   ' TBar1.ButtonState(1) = BS_IS_INVISIBLE
  94.  
  95.   Form1.Show
  96.   Form2.Show
  97.  
  98.   Form1.SetFocus
  99.  
  100. End Sub
  101.  
  102. Sub mnuTest_Click ()
  103.  
  104.   Static A As Integer
  105.  
  106.   If A = 1 Then
  107.     A = 0
  108.     TBar1.ButtonState(7) = BS_IS_TOGGLED
  109.   Else
  110.     A = 1
  111.     TBar1.ButtonState(7) = BS_IS_NOTTOGGLED
  112.   End If
  113.  
  114.  
  115. End Sub
  116.  
  117. Sub TBar1_Click (Button As Integer)
  118.  
  119.   Debug.Print "Button "; Button; " was clicked!"
  120.  
  121. End Sub
  122.  
  123. Sub TBar1_DoubleClick (Button As Integer)
  124.  
  125.   Debug.Print "Double click received for button "; Button
  126.  
  127. End Sub
  128.  
  129. Sub TBar1_MouseDown (MouseButton As Integer, Shift As Integer, X As Single, Y As Single, Button As Integer)
  130.  
  131.   If MouseButton And 1 Then Debug.Print "Left mouse button is pressed!  Button is "; Button
  132.   If MouseButton And 2 Then Debug.Print "Right mouse button is pressed!  Button is "; Button
  133.   If MouseButton And 4 Then Debug.Print "Middle mouse button is pressed! Button is "; Button
  134.   If Shift And 1 Then Debug.Print "Shift button is down"
  135.   If Shift And 2 Then Debug.Print "Control button is down"
  136.   If Shift And 4 Then Debug.Print "Alt button is down"
  137.  
  138. End Sub
  139.  
  140. Sub TBar1_MouseMove (MouseButton As Integer, Shift As Integer, X As Single, Y As Single, Button As Integer)
  141.  
  142.   Dim CurX As Integer, CurY As Integer
  143.  
  144.   CurX = -1
  145.   CurY = -1
  146.  
  147.   If Button <> -1 Then
  148.  
  149.     Select Case Button
  150.       Case 0:
  151.     Label1.Caption = "Open an empty document"
  152.       Case 1:
  153.     Label1.Caption = "Open existing document"
  154.       Case 2:
  155.     Label1.Caption = "Save current document"
  156.       Case 3:
  157.     Label1.Caption = "Cut currently selected text"
  158.       Case 4:
  159.     Label1.Caption = "Cut currently selected text to the clipboard"
  160.       Case 5:
  161.     Label1.Caption = "Insert text in clipboard into text"
  162.       Case 6:
  163.     Label1.Caption = "Change line styles"
  164.       Case 7:
  165.     Label1.Caption = "Print the current document"
  166.       Case 8:
  167.     Label1.Caption = "Open help"
  168.       Case 9:
  169.     Label1.Caption = "Open context sensitive help"
  170.     End Select
  171.   Else
  172.     Label1.Caption = "Mouse is moving"
  173.   End If
  174.  
  175.   ' Uncommenting this line doesn't allow other events to be processed
  176.   ' So uncomment it only for testing purposes
  177.   ' If CurX <> X Or CurY <> Y Then Debug.Print "Mouse is at:"; X; ","; Y
  178.  
  179.   'If MouseButton And 1 Then Debug.Print "Left mouse button is pressed!"
  180.   'If MouseButton And 2 Then Debug.Print "Right mouse button is pressed!"
  181.   'If MouseButton And 4 Then Debug.Print "Middle mouse button is pressed!"
  182.   'If Shift And 1 Then Debug.Print "Shift button is down"
  183.   'If Shift And 2 Then Debug.Print "Control button is down"
  184.  
  185. End Sub
  186.  
  187. Sub TBar1_MouseUp (MouseButton As Integer, Shift As Integer, X As Single, Y As Single, Button As Integer)
  188.  
  189.   'If MouseButton And 1 Then Debug.Print "Left mouse button is Up!  Button is "; Button
  190.   'If MouseButton And 2 Then Debug.Print "Right mouse button is Up!  Button is "; Button
  191.   'If MouseButton And 4 Then Debug.Print "Middle mouse button is Up! Button is "; Button
  192.   'If Shift And 1 Then Debug.Print "Shift button is down"
  193.   'If Shift And 2 Then Debug.Print "Control button is down"
  194.   'If Shift And 4 Then Debug.Print "Alt button is down"
  195.  
  196. End Sub
  197.  
  198. Sub TBar1_Toggle (Button As Integer, State As Integer)
  199.  
  200.   Dim aString
  201.  
  202.   If State Then
  203.     aString = "On."
  204.   Else
  205.     aString = "Off."
  206.   End If
  207.  
  208.   Debug.Print "Button "; Button; " toggled to "; aString
  209.  
  210. End Sub
  211.  
  212.