home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / mabry / menuev32 / sample / mesampl2.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-02-01  |  2.8 KB  |  96 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "MenuEv Sample 2"
  4.    ClientHeight    =   990
  5.    ClientLeft      =   1500
  6.    ClientTop       =   3150
  7.    ClientWidth     =   5760
  8.    Height          =   1680
  9.    Left            =   1440
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   990
  12.    ScaleWidth      =   5760
  13.    Top             =   2520
  14.    Width           =   5880
  15.    Begin TextBox Text1 
  16.       Height          =   285
  17.       Left            =   2640
  18.       TabIndex        =   0
  19.       Text            =   "Status Message"
  20.       Top             =   480
  21.       Width           =   2895
  22.    End
  23.    Begin MenuEvent MenuEv1 
  24.       Left            =   2040
  25.       LinkControl     =   ""
  26.       LinkProperty    =   ""
  27.       Top             =   360
  28.    End
  29.    Begin Label Label2 
  30.       Caption         =   "Everything is far to the right so you can see it when the system menu is up"
  31.       Height          =   855
  32.       Left            =   120
  33.       TabIndex        =   2
  34.       Top             =   120
  35.       Visible         =   0   'False
  36.       Width           =   1815
  37.    End
  38.    Begin Label Label1 
  39.       Caption         =   "Simulated Status Bar:"
  40.       Height          =   255
  41.       Left            =   2640
  42.       TabIndex        =   1
  43.       Top             =   240
  44.       Width           =   1935
  45.    End
  46.    Begin Menu File 
  47.       Caption         =   "File"
  48.       Tag             =   "File Menu"
  49.    End
  50.    Begin Menu Edit 
  51.       Caption         =   "Edit"
  52.       Tag             =   "Edit Menu"
  53.    End
  54. Option Explicit
  55. ''''''''''''''''''''''''''''
  56. ' MenuEv global constant file. This file can be loaded
  57. ' into a code module.
  58. ' These constants define the contents of the Flags
  59. ' parameter of the MenuEvent event.
  60. ''''''''''''''''''''''''''''
  61. Const MF_GRAYED = &H1
  62. Const MF_DISABLED = &H2
  63. Const MF_BITMAP = &H4
  64. Const MF_CHECKED = &H8
  65. Const MF_POPUP = &H10
  66. Const MF_OWNERDRAW = &H100
  67. Const MF_SYSMENU = &H2000
  68. Const MF_MOUSESELECT = &H8000
  69. Dim InMenu As Integer
  70. Dim SaveStatus As String
  71. Sub Form_Load ()
  72.     ' start with not being in a menu
  73.     InMenu = False
  74. End Sub
  75. Sub MenuEv1_MenuEvent (MenuText As String, Flags As Integer, Tag As String, HelpContextID As Long)
  76.     ' if this is the first time in, save the status bar
  77.     If InMenu = False Then
  78.         SaveStatus = Text1
  79.     End If
  80.     ' we're in a menu now
  81.     InMenu = True
  82.     ' if we're in the system menu, format the text appropriately
  83.     If Flags And MF_SYSMENU Then
  84.         Text1 = "System Menu: " & MenuText
  85.     Else
  86.         ' otherwise, this is a normal menu
  87.         Text1 = Tag
  88.     End If
  89. End Sub
  90. Sub MenuEv1_MenuExit ()
  91.     ' restore the status bar and set the flag indicating
  92.     ' that we're out of the menus
  93.     Text1 = SaveStatus
  94.     InMenu = False
  95. End Sub
  96.