home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / VISBASIC / MSMEGA / MENUEVSA.ZIP / MESAMPL2.FRM < prev    next >
Text File  |  1995-02-01  |  3KB  |  108 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. End
  55. Option Explicit
  56.  
  57. ''''''''''''''''''''''''''''
  58. ' MenuEv global constant file. This file can be loaded
  59. ' into a code module.
  60. '
  61. ' These constants define the contents of the Flags
  62. ' parameter of the MenuEvent event.
  63. '
  64. ''''''''''''''''''''''''''''
  65.  
  66. Const MF_GRAYED = &H1
  67. Const MF_DISABLED = &H2
  68. Const MF_BITMAP = &H4
  69. Const MF_CHECKED = &H8
  70. Const MF_POPUP = &H10
  71. Const MF_OWNERDRAW = &H100
  72. Const MF_SYSMENU = &H2000
  73. Const MF_MOUSESELECT = &H8000
  74.  
  75. Dim InMenu As Integer
  76. Dim SaveStatus As String
  77.  
  78. Sub Form_Load ()
  79.     ' start with not being in a menu
  80.     InMenu = False
  81. End Sub
  82.  
  83. Sub MenuEv1_MenuEvent (MenuText As String, Flags As Integer, Tag As String, HelpContextID As Long)
  84.     ' if this is the first time in, save the status bar
  85.     If InMenu = False Then
  86.         SaveStatus = Text1
  87.     End If
  88.  
  89.     ' we're in a menu now
  90.     InMenu = True
  91.  
  92.     ' if we're in the system menu, format the text appropriately
  93.     If Flags And MF_SYSMENU Then
  94.         Text1 = "System Menu: " & MenuText
  95.     Else
  96.         ' otherwise, this is a normal menu
  97.         Text1 = Tag
  98.     End If
  99. End Sub
  100.  
  101. Sub MenuEv1_MenuExit ()
  102.     ' restore the status bar and set the flag indicating
  103.     ' that we're out of the menus
  104.     Text1 = SaveStatus
  105.     InMenu = False
  106. End Sub
  107.  
  108.