home *** CD-ROM | disk | FTP | other *** search
- Type PopupMenuSampleForm From SampleMasterForm
- Dim Frame1 As New Frame
- Dim CHKEnableRed As New CheckBox
- Dim CHKEnableOrange As New CheckBox
- Dim CHKEnableYellow As New CheckBox
- Dim CHKEnableGreen As New CheckBox
- Dim CHKEnableBlue As New CheckBox
- Dim CHKEnablePurple As New CheckBox
- Type CustomPopup From PopupMenu
- Dim Caller As Object
-
- ' METHODS for object: PopupMenuSampleForm.CustomPopup
- Sub TargetTrack(ByVal ownerWindow as Object, ByVal x as Long, ByVal y as Long)
- ' TargetTrack is a custom method to demonstrate how to add custom
- ' functionality to existing PopupMenus. In this case, I want a
- ' way to find out the control who recieved the MouseDown event
- ' since the PopupMenu will do something to that control.
- Caller = ownerWindow
- Track(ownerWindow, x, y)
- End Sub
-
- End Type
- Dim ControlPopup As New PopupMenuSampleForm.CustomPopup
- Type LBLBackColor From Label
-
- ' METHODS for object: PopupMenuSampleForm.LBLBackColor
- Sub Blue_Click()
- BackColor = RGB(0, 0, 255)
- End Sub
-
- Sub Green_Click()
- BackColor = RGB(0, 255, 0)
- End Sub
-
- Sub Orange_Click()
- BackColor = RGB(255, 255 / 2, 0)
- End Sub
-
- Sub Purple_Click()
- BackColor = RGB(255 / 2, 0, 255 / 2)
- End Sub
-
- Sub Red_Click()
- BackColor = RGB(255, 0, 0)
- End Sub
-
- Sub Yellow_Click()
- BackColor = RGB(255, 255, 0)
- End Sub
-
- End Type
- Type LBLForeColor From PopupMenuSampleForm.LBLBackColor
-
- ' METHODS for object: PopupMenuSampleForm.LBLForeColor
- Sub Blue_Click()
- ForeColor = RGB(0, 0, 255)
- End Sub
-
- Sub Green_Click()
- ForeColor = RGB(0, 255, 0)
- End Sub
-
- Sub Orange_Click()
- ForeColor = RGB(255, 255 / 2, 0)
- End Sub
-
- Sub Purple_Click()
- ForeColor = RGB(255 / 2, 0, 255 / 2)
- End Sub
-
- Sub Red_Click()
- ForeColor = RGB(255, 0, 0)
- End Sub
-
- Sub Yellow_Click()
- ForeColor = RGB(255, 255, 0)
- End Sub
-
- End Type
- Dim Frame2 As New Frame
- Dim Frame3 As New Frame
- Dim LBLTogglePopup As New Label
- Dim OBEnablePopup As New OptionButton
- Dim OBDisablePopup As New OptionButton
- Type HPCNoPopupRegion From Form
- Dim Frame1 As New Frame
- Type LBLTrackPopup From Label
-
- ' METHODS for object: PopupMenuSampleForm.HPCNoPopupRegion.LBLTrackPopup
- Sub MouseDown(button As Integer, shift As Integer, x As Single, y As Single)
- If button = 2 Then PopupMenuSampleForm.ControlPopup.Track(Me, x, y)
- End Sub
-
- End Type
- Type LBLBothButtons From Label
-
- ' METHODS for object: PopupMenuSampleForm.HPCNoPopupRegion.LBLBothButtons
- Sub MouseDown(button As Integer, shift As Integer, x As Single, y As Single)
- PopupMenuSampleForm.ControlPopup.Track(Me, x, y)
- End Sub
-
- End Type
- Type LBLBothButtons1 From PopupMenuSampleForm.HPCNoPopupRegion.LBLBothButtons
-
- ' METHODS for object: PopupMenuSampleForm.HPCNoPopupRegion.LBLBothButtons1
- Sub MouseDown(button As Integer, shift As Integer, x As Single, y As Single)
- If button = 1 && shift = 1 Then PopupMenuSampleForm.ControlPopup.Track(Me, x, y)
- End Sub
-
- End Type
-
- ' METHODS for object: PopupMenuSampleForm.HPCNoPopupRegion
- Sub ReadMe
- ' A HyperControl can have controls on it, and can intercept the
- ' main form's PopupMenu...allowing regions where the form's Popup
- ' can be supressed.
- End Sub
-
- Sub Resize()
- Frame1.Move(0, 0, ScaleWidth, ScaleHeight)
- End Sub
-
- End Type
-
- ' METHODS for object: PopupMenuSampleForm
- Function Blue_Enable() As Integer
- Blue_Enable = (CHKEnableBlue.Value = "Checked")
- End Function
-
- Function Green_Enable() As Integer
- Green_Enable = (CHKEnableGreen.Value = "Checked")
- End Function
-
- Sub OBDisablePopup_Click()
- ' Setting the PopupMenu reference on an object to "FindObject(PopupMenu)" would
- ' cause the default PopupMenu to come up. But, the default PopupMenu
- ' should never have any items on it, so it doesn't appear. Setting
- ' the reference to Nothing causes the Label's container's PopupMenu
- ' to appear, which is the one on the Form. Note that the Form is the
- ' container for the label and NOT the Frame. It may look like the
- ' label is in the frame, but in reality, it is only placed on top
- ' of the frame, and has no other relation to it. In fact, frames
- ' can not have PopupMenus
- LBLTogglePopup.PopupMenu = IIf(OBEnablePopup.Value, Nothing, FindObject("PopupMenu"))
- End Sub
-
- Sub OBEnablePopup_Click()
- ' See the remark in the OBDisablePopup_Click method
- LBLTogglePopup.PopupMenu = IIf(OBEnablePopup.Value, Nothing, FindObject("PopupMenu"))
- End Sub
-
- Function Orange_Enable() As Integer
- Orange_Enable = (CHKEnableOrange.Value = "Checked")
- End Function
-
- Function Purple_Enable() As Integer
- Purple_Enable = (CHKEnablePurple.Value = "Checked")
- End Function
-
- Function Red_Enable() As Integer
- Red_Enable = (CHKEnableRed.Value = "Checked")
- End Function
-
- Sub ResetApplication_Click
- OBEnablePopup.Value = True
- CHKEnableRed.Value = "Checked"
- CHKEnableBlue.Value = "Checked"
- CHKEnableGreen.Value = "Checked"
- CHKEnableOrange.Value = "Unchecked"
- CHKEnableYellow.Value = "Unchecked"
- CHKEnablePurple.Value = "Unchecked"
- End Sub
-
- Function Yellow_Enable() As Integer
- Yellow_Enable = (CHKEnableYellow.Value = "Checked")
- End Function
-
- End Type
-
- Type PopupMenuSample From Application
- Dim AccessControl As New ACL
- End Type
-
- Begin Code
- ' Reconstruction commands for object: SampleMasterFormHelpMenu
- '
- With SampleMasterFormHelpMenu
-
- .InsertItem("HelpContents", "&Contents", -1)
- End With 'SampleMasterFormHelpMenu
- ' Reconstruction commands for object: PopupMenuSampleForm
- '
- With PopupMenuSampleForm
- .Caption := "BOOT CAMP Sample"
- .PopupMenu := PopupMenuSampleForm.ControlPopup
- .Move(1890, 1665, 8370, 6060)
- .Outlined := True
- .MenuBar := SampleMasterFormMenuBar
- .SampleDir := "C:\Current\Popmenu\"
- .SampleName := "Popmenu"
- With .helpfile
- .FileName := "C:\Current\Popmenu\Popmenu.hlp"
- End With 'PopupMenuSampleForm.helpfile
- With .Frame1
- .Caption := "Enablers"
- .ZOrder := 13
- .Move(6150, 150, 1950, 4950)
- End With 'PopupMenuSampleForm.Frame1
- With .CHKEnableRed
- .Caption := "Red"
- .Value := "Checked"
- .ZOrder := 7
- .Move(6300, 450, 1650, 600)
- End With 'PopupMenuSampleForm.CHKEnableRed
- With .CHKEnableOrange
- .Caption := "Orange"
- .ZOrder := 8
- .Move(6300, 1200, 1650, 600)
- End With 'PopupMenuSampleForm.CHKEnableOrange
- With .CHKEnableYellow
- .Caption := "Yellow"
- .Value := "Checked"
- .ZOrder := 9
- .Move(6300, 1950, 1650, 600)
- End With 'PopupMenuSampleForm.CHKEnableYellow
- With .CHKEnableGreen
- .Caption := "Green"
- .ZOrder := 10
- .Move(6300, 2700, 1650, 600)
- End With 'PopupMenuSampleForm.CHKEnableGreen
- With .CHKEnableBlue
- .Caption := "Blue"
- .ZOrder := 11
- .Move(6300, 3450, 1650, 600)
- End With 'PopupMenuSampleForm.CHKEnableBlue
- With .CHKEnablePurple
- .Caption := "Purple"
- .Value := "Checked"
- .ZOrder := 12
- .Move(6300, 4200, 1650, 600)
- End With 'PopupMenuSampleForm.CHKEnablePurple
- With .CustomPopup
-
- .Caller := Nothing
- End With 'PopupMenuSampleForm.CustomPopup
- With .ControlPopup
-
- .InsertItem("Red", "Red", -1)
- .InsertItem("Orange", "Orange", -1)
- .InsertItem("Yellow", "Yellow", -1)
- .InsertItem("Green", "Green", -1)
- .InsertItem("Blue", "Blue", -1)
- .InsertItem("Purple", "Purple", -1)
- End With 'PopupMenuSampleForm.ControlPopup
- With .LBLBackColor
- .Caption := "This Label uses the same PopupMenu as the form, and handles its own Click Events"
- .BackColor := 8323199
- .ForeColor := 16777215
- .ZOrder := 6
- .PopupMenu := PopupMenuSampleForm.ControlPopup
- .Move(300, 450, 2850, 975)
- .BorderStyle := "Fixed Single"
- .Alignment := "Center"
- End With 'PopupMenuSampleForm.LBLBackColor
- With .LBLForeColor
- .Caption := "This Label also uses the same PopupMenu as the form, but handles its click events differently"
- .BackColor := 16777215
- .ForeColor := 8323199
- .ZOrder := 5
- .Move(300, 1500, 2850, 975)
- End With 'PopupMenuSampleForm.LBLForeColor
- With .Frame2
- .Caption := "Simple click event handlers"
- .ZOrder := 14
- .Move(150, 150, 3150, 2550)
- End With 'PopupMenuSampleForm.Frame2
- With .Frame3
- .Caption := "Enabling and Disabling"
- .ZOrder := 4
- .Move(3450, 150, 2550, 2550)
- End With 'PopupMenuSampleForm.Frame3
- With .LBLTogglePopup
- .Caption := "This Label can allow or disallow the form's PopupMenu to come through"
- .BackColor := 8388736
- .ForeColor := 16777215
- .ZOrder := 3
- .Move(3600, 450, 2250, 1050)
- .BorderStyle := "Fixed Single"
- .Alignment := "Center"
- End With 'PopupMenuSampleForm.LBLTogglePopup
- With .OBEnablePopup
- .Caption := "Enable Popup"
- .ZOrder := 2
- .Move(3600, 1650, 2250, 450)
- .TabStop := True
- .Value := True
- End With 'PopupMenuSampleForm.OBEnablePopup
- With .OBDisablePopup
- .Caption := "Disable Popup"
- .ZOrder := 1
- .Move(3600, 2100, 2250, 450)
- End With 'PopupMenuSampleForm.OBDisablePopup
- With .HPCNoPopupRegion
- .ZOrder := 15
- .PopupMenu := PopupMenu
- .Move(150, 2850, 5850, 2250)
- .Outlined := True
- .BorderStyle := "None"
- .MaxButton := False
- .ControlBox := False
- .Parent := PopupMenuSampleForm
- .Visible := True
- With .Frame1
- .Caption := "This region blocks the main form's PopupMenu"
- .ZOrder := 4
- .Move(0, 0, 5850, 2250)
- End With 'PopupMenuSampleForm.HPCNoPopupRegion.Frame1
- With .LBLTrackPopup
- .Caption := "This Label uses the Track method for PopupMenus"
- .BackColor := 8388736
- .ForeColor := 16777215
- .ZOrder := 3
- .Move(150, 300, 1725, 1800)
- .BorderStyle := "Fixed Single"
- .Alignment := "Center"
- End With 'PopupMenuSampleForm.HPCNoPopupRegion.LBLTrackPopup
- With .LBLBothButtons
- .Caption := "This Label lets the user use either mouse button for PopupMenus"
- .BackColor := 8388736
- .ForeColor := 16777215
- .ZOrder := 2
- .Move(2055, 300, 1725, 1800)
- .BorderStyle := "Fixed Single"
- .Alignment := "Center"
- End With 'PopupMenuSampleForm.HPCNoPopupRegion.LBLBothButtons
- With .LBLBothButtons1
- .Caption := "This Label will only bring up a PopupMenu if the Left Button is pressed while the shift key is held down"
- .ZOrder := 1
- .Move(3960, 300, 1725, 1800)
- End With 'PopupMenuSampleForm.HPCNoPopupRegion.LBLBothButtons1
- End With 'PopupMenuSampleForm.HPCNoPopupRegion
- End With 'PopupMenuSampleForm
- ' Reconstruction commands for object: PopupMenuSample
- '
- With PopupMenuSample
- .ModulePath := "base.ebo;win32.ebo;dialogs.ebo;tools.ebo;Popmenu.eto"
- .ProjectFileName := "C:\Current\Popmenu\Popmenu.epj"
- .Path := "C:\Current\Popmenu\"
- .EXEName := "Popmenu"
- With .AccessControl
- .ObjectAccess := "R,W,C,M,P"
- End With 'PopupMenuSample.AccessControl
- End With 'PopupMenuSample
- End Code
-