home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / popupre / modchild.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-03-03  |  3.1 KB  |  97 lines

  1. VERSION 2.00
  2. Begin Form frmModalChild 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Modal Child"
  6.    ClientHeight    =   975
  7.    ClientLeft      =   3330
  8.    ClientTop       =   4605
  9.    ClientWidth     =   3315
  10.    Height          =   1380
  11.    Left            =   3270
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   975
  15.    ScaleWidth      =   3315
  16.    Top             =   4260
  17.    Width           =   3435
  18.    Begin CommandButton cmdClose 
  19.       Cancel          =   -1  'True
  20.       Caption         =   "Close"
  21.       Default         =   -1  'True
  22.       Height          =   345
  23.       Left            =   1335
  24.       TabIndex        =   0
  25.       Top             =   315
  26.       Width           =   1485
  27.    End
  28.    Begin Image imgButtonUp 
  29.       Height          =   330
  30.       Left            =   2865
  31.       Picture         =   MODCHILD.FRX:0000
  32.       Top             =   15
  33.       Visible         =   0   'False
  34.       Width           =   360
  35.    End
  36.    Begin Image imgButtonDown 
  37.       Height          =   330
  38.       Left            =   2865
  39.       Picture         =   MODCHILD.FRX:0182
  40.       Top             =   345
  41.       Visible         =   0   'False
  42.       Width           =   360
  43.    End
  44.    Begin Image imgPopUp 
  45.       Height          =   330
  46.       Left            =   450
  47.       Top             =   345
  48.       Width           =   360
  49.    End
  50.    Begin Label lblMenuClick 
  51.       BackColor       =   &H000000FF&
  52.       ForeColor       =   &H000000FF&
  53.       Height          =   225
  54.       Left            =   2910
  55.       TabIndex        =   1
  56.       Top             =   735
  57.       Visible         =   0   'False
  58.       Width           =   285
  59.    End
  60. Option Explicit
  61. Sub cmdClose_Click ()
  62.     ' Unload the form when 'Close' is pressed
  63.     Unload Me
  64. End Sub
  65. Sub Form_Load ()
  66.     ' Show 'button up' image initially
  67.     imgPopUp = imgButtonUp
  68. End Sub
  69. Sub HandleMyPopUp (P_nIndex As Integer)
  70. ' This sub would handle the clicks on the menu entries of the
  71. ' child popup menu received by lblMenuClick from frmMenuContainer
  72.     Select Case P_nIndex
  73.     Case 0:
  74.     Case 1:
  75.     Case 2:
  76.     Case 3:
  77.     End Select
  78. End Sub
  79. Sub imgPopUp_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  80.     ' Show 'button down' image
  81.     imgPopUp = imgButtonDown
  82.     ' !!! THIS POPUPMENU METHOD DOES NOT INVOKE THE CHILD POPUP MENU
  83.     ' BECAUSE OF THE NON-REENTRANCY OF THE MENU CONTAINER WINDOW CODE !!!
  84.     PopupMenu frmMenuContainer.mnuPopUpChild, 0
  85.     ' Show 'button up' image
  86.     imgPopUp = imgButtonUp
  87. End Sub
  88. Sub lblMenuClick_Change ()
  89. ' The 'Change' event of this label is triggered when a click on
  90. ' a menu entry in frmMenuContainer sets the label caption with the
  91. ' related menu entry index
  92.     ' Handle the menu click if an index is available
  93.     If lblMenuClick <> "" Then HandleMyPopUp Val(lblMenuClick)
  94.     ' Reset the label for new menu entry clicks
  95.     lblMenuClick = ""
  96. End Sub
  97.