home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Form1
- Caption = "MenuEv Sample 2"
- ClientHeight = 990
- ClientLeft = 1500
- ClientTop = 3150
- ClientWidth = 5760
- Height = 1680
- Left = 1440
- LinkTopic = "Form1"
- ScaleHeight = 990
- ScaleWidth = 5760
- Top = 2520
- Width = 5880
- Begin TextBox Text1
- Height = 285
- Left = 2640
- TabIndex = 0
- Text = "Status Message"
- Top = 480
- Width = 2895
- End
- Begin MenuEvent MenuEv1
- Left = 2040
- LinkControl = ""
- LinkProperty = ""
- Top = 360
- End
- Begin Label Label2
- Caption = "Everything is far to the right so you can see it when the system menu is up"
- Height = 855
- Left = 120
- TabIndex = 2
- Top = 120
- Visible = 0 'False
- Width = 1815
- End
- Begin Label Label1
- Caption = "Simulated Status Bar:"
- Height = 255
- Left = 2640
- TabIndex = 1
- Top = 240
- Width = 1935
- End
- Begin Menu File
- Caption = "File"
- Tag = "File Menu"
- End
- Begin Menu Edit
- Caption = "Edit"
- Tag = "Edit Menu"
- End
- Option Explicit
- ''''''''''''''''''''''''''''
- ' MenuEv global constant file. This file can be loaded
- ' into a code module.
- ' These constants define the contents of the Flags
- ' parameter of the MenuEvent event.
- ''''''''''''''''''''''''''''
- Const MF_GRAYED = &H1
- Const MF_DISABLED = &H2
- Const MF_BITMAP = &H4
- Const MF_CHECKED = &H8
- Const MF_POPUP = &H10
- Const MF_OWNERDRAW = &H100
- Const MF_SYSMENU = &H2000
- Const MF_MOUSESELECT = &H8000
- Dim InMenu As Integer
- Dim SaveStatus As String
- Sub Form_Load ()
- ' start with not being in a menu
- InMenu = False
- End Sub
- Sub MenuEv1_MenuEvent (MenuText As String, Flags As Integer, Tag As String, HelpContextID As Long)
- ' if this is the first time in, save the status bar
- If InMenu = False Then
- SaveStatus = Text1
- End If
- ' we're in a menu now
- InMenu = True
- ' if we're in the system menu, format the text appropriately
- If Flags And MF_SYSMENU Then
- Text1 = "System Menu: " & MenuText
- Else
- ' otherwise, this is a normal menu
- Text1 = Tag
- End If
- End Sub
- Sub MenuEv1_MenuExit ()
- ' restore the status bar and set the flag indicating
- ' that we're out of the menus
- Text1 = SaveStatus
- InMenu = False
- End Sub
-