home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form fMain
- Caption = "MicroHelp VBTools 5 - Mh3dDrive Example"
- ClientHeight = 5340
- ClientLeft = 1668
- ClientTop = 876
- ClientWidth = 6552
- Height = 5724
- Left = 1620
- LinkTopic = "Form1"
- LockControls = -1 'True
- ScaleHeight = 5340
- ScaleWidth = 6552
- Top = 540
- Width = 6648
- Begin VB.Frame frmDrive
- Caption = "frmDrive(3)"
- Height = 1230
- Index = 3
- Left = 135
- TabIndex = 7
- Top = 1980
- Width = 3570
- Begin VB.CommandButton cmdAction
- Caption = "cmdAction(3)"
- Height = 375
- Index = 3
- Left = 2070
- TabIndex = 11
- Top = 720
- Width = 1365
- End
- Begin VB.CheckBox chkSearch
- Caption = "chkSearch"
- Height = 240
- Left = 180
- TabIndex = 10
- Top = 765
- Width = 1770
- End
- Begin VB.TextBox txtSearch
- Height = 285
- Left = 1305
- TabIndex = 9
- Text = "txtSearch"
- Top = 315
- Width = 2085
- End
- Begin VB.Label lblSearch
- Caption = "lblSearch"
- Height = 195
- Left = 180
- TabIndex = 8
- Top = 360
- Width = 1050
- End
- End
- Begin VB.Frame frmDrive
- Caption = "frmDrive(2)"
- Height = 1680
- Index = 2
- Left = 135
- TabIndex = 0
- Top = 135
- Width = 3570
- Begin VB.TextBox txtAdd
- Height = 285
- Left = 1620
- TabIndex = 6
- Text = "txtAdd"
- Top = 1170
- Width = 1770
- End
- Begin VB.CommandButton cmdAction
- Caption = "cmdAction(0)"
- Height = 375
- Index = 0
- Left = 180
- TabIndex = 1
- Top = 450
- Width = 1365
- End
- Begin VB.CommandButton cmdAction
- Caption = "cmdAction(1)"
- Height = 375
- Index = 1
- Left = 180
- TabIndex = 4
- Top = 1080
- Width = 1365
- End
- Begin VB.Label lblRemove
- BorderStyle = 1 'Fixed Single
- Caption = "lblRemove"
- Height = 285
- Left = 1620
- TabIndex = 3
- Top = 540
- Width = 1770
- End
- Begin VB.Label lblItem
- Caption = "lblItem(0)"
- Height = 195
- Index = 0
- Left = 1620
- TabIndex = 2
- Top = 315
- Width = 1770
- End
- Begin VB.Label lblItem
- Caption = "lblItem(1)"
- Height = 195
- Index = 1
- Left = 1620
- TabIndex = 5
- Top = 945
- Width = 1770
- End
- End
- Begin VB.CommandButton cmdAction
- Caption = "cmdAction(2)"
- Height = 375
- Index = 2
- Left = 5040
- TabIndex = 24
- Top = 4815
- Width = 1365
- End
- Begin VB.Frame frmDrive
- Caption = "frmDrive(1)"
- Height = 1815
- Index = 1
- Left = 2385
- TabIndex = 18
- Top = 3375
- Width = 2490
- Begin VB.OptionButton optDrive
- Caption = "optDrive(2)"
- Height = 240
- Index = 2
- Left = 180
- TabIndex = 21
- Top = 945
- Width = 1095
- End
- Begin VB.OptionButton optDrive
- Caption = "optDrive(1)"
- Height = 240
- Index = 1
- Left = 180
- TabIndex = 20
- Top = 630
- Value = -1 'True
- Width = 1140
- End
- Begin VB.OptionButton optDrive
- Caption = "optDrive(0)"
- Height = 240
- Index = 0
- Left = 180
- TabIndex = 19
- Top = 315
- Width = 1140
- End
- Begin VB.Label lblDrive
- Caption = "lblDrive(1)"
- Height = 195
- Index = 1
- Left = 945
- TabIndex = 23
- Top = 1485
- Width = 1320
- End
- Begin VB.Label lblDrive
- Caption = "lblDrive(0)"
- Height = 195
- Index = 0
- Left = 945
- TabIndex = 22
- Top = 1215
- Width = 1320
- End
- Begin VB.Image imgDrive
- Height = 192
- Index = 0
- Left = 456
- Picture = "mhdriv_a.frx":0000
- Top = 1212
- Width = 336
- End
- Begin VB.Image imgDrive
- Height = 192
- Index = 1
- Left = 456
- Picture = "mhdriv_a.frx":0182
- Top = 1488
- Width = 336
- End
- End
- Begin VB.Frame frmDrive
- Caption = "frmDrive(0)"
- Height = 1815
- Index = 0
- Left = 135
- TabIndex = 12
- Top = 3375
- Width = 2085
- Begin VB.CheckBox chkDrive
- Caption = "chkDrive(4)"
- Height = 240
- Index = 4
- Left = 180
- TabIndex = 17
- Top = 1395
- Value = 1 'Checked
- Width = 1725
- End
- Begin VB.CheckBox chkDrive
- Caption = "chkDrive(3)"
- Height = 240
- Index = 3
- Left = 180
- TabIndex = 16
- Top = 1125
- Value = 1 'Checked
- Width = 1500
- End
- Begin VB.CheckBox chkDrive
- Caption = "chkDrive(2)"
- Height = 240
- Index = 2
- Left = 180
- TabIndex = 15
- Top = 855
- Value = 1 'Checked
- Width = 1545
- End
- Begin VB.CheckBox chkDrive
- Caption = "chkDrive(1)"
- Height = 240
- Index = 1
- Left = 180
- TabIndex = 14
- Top = 585
- Value = 1 'Checked
- Width = 1500
- End
- Begin VB.CheckBox chkDrive
- Caption = "chkDrive(0)"
- Height = 240
- Index = 0
- Left = 180
- TabIndex = 13
- Top = 315
- Value = 1 'Checked
- Width = 1545
- End
- End
- Begin VB.Label lblDescription
- Alignment = 2 'Center
- BackStyle = 0 'Transparent
- Caption = "lblDescription"
- Height = 1455
- Left = 3870
- TabIndex = 26
- Top = 135
- Width = 2535
- End
- Begin MhgdrlLib.Mh3dDrive drlSample
- Height = 372
- Left = 3876
- TabIndex = 25
- Top = 1668
- Width = 2580
- _Version = 65536
- _ExtentX = 4551
- _ExtentY = 656
- _StockProps = 77
- BackColor = 12632256
- TintColor = 16711935
- BevelStyleInner = 0
- BevelSizeInner = 0
- BorderStyle = 1
- BorderColor = 0
- Case = 0
- DividerStyle = 0
- FillColor = 12632256
- FontStyle = 0
- LightColor = 16777215
- PictureHeight = 16
- PictureWidth = 28
- ShadowColor = 8421504
- WallPaper = 0
- TextColor = 0
- MaxDrop = 8
- DefaultPics = -1 'True
- DriveFixed = -1 'True
- DriveRemote = -1 'True
- DriveRemovable = -1 'True
- HighColor = 16777215
- SelectedColor = 8388608
- Transparent = 0 'False
- TransparentColor= 1
- DriveCDRom = -1 'True
- DriveRamDisk = -1 'True
- End
- Attribute VB_Name = "fMain"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Sub LoadCaptions()
- Dim sCaption As String
- sCaption = "The drive control has the functionality of both "
- sCaption = sCaption & "a drive list box and a combo box. You can add, "
- sCaption = sCaption & "delete, and search for items. Also, you can "
- sCaption = sCaption & "control what drive types will be displayed and "
- sCaption = sCaption & "the image that will be displayed with them."
- lblDescription.Caption = sCaption
- ' Frames.
- frmDrive(0).Caption = "Drive Types Displayed"
- frmDrive(1).Caption = "Drive Icons"
- frmDrive(2).Caption = "Adding and Removing Items"
- frmDrive(3).Caption = "Searching for Items"
- ' Drive types.
- chkDrive(0).Caption = "CD-ROM Drives"
- chkDrive(1).Caption = "Fixed Drives"
- chkDrive(2).Caption = "RAM-Disks"
- chkDrive(3).Caption = "Remote Drives"
- chkDrive(4).Caption = "Removable Drives"
- ' Drive icons.
- optDrive(0).Caption = "None."
- optDrive(1).Caption = "Default."
- optDrive(2).Caption = "Custom:"
- lblDrive(0).Caption = ".Picture"
- lblDrive(1).Caption = ".PictureSel"
- ' Adding and removing.
- lblRemove.Caption = drlSample.Drive
- txtAdd.Text = "(enter new item)"
- lblItem(0).Caption = "Item to be removed:"
- lblItem(1).Caption = "String to be added:"
- ' Searching.
- lblSearch.Caption = "Search String"
- txtSearch.Text = "(enter search string)"
- chkSearch.Caption = "Use InString Search."
- ' Command buttons.
- cmdAction(0).Caption = "&RemoveItem"
- cmdAction(1).Caption = "&AddItem"
- cmdAction(2).Caption = "E&xit"
- cmdAction(3).Caption = "&Search"
- End Sub
- Private Sub chkDrive_Click(Index As Integer)
- Dim iValue As Integer
- iValue = chkDrive(Index).Value
- ' Defer redrawing the control until after
- ' all pictures have been loaded or unloaded.
- drlSample.Screenupdate = False
- ' Toggle the specific drive type to display.
- Select Case Index
- Case 0
- drlSample.DriveCDRom = iValue
- Case 1
- drlSample.DriveFixed = iValue
- Case 2
- drlSample.DriveRamDisk = iValue
- Case 3
- drlSample.DriveRemote = iValue
- Case 4
- drlSample.DriveRemovable = iValue
- End Select
- ' Redraw control now that all pictures
- ' have been changed.
- drlSample.Screenupdate = True
- End Sub
- Private Sub cmdAction_Click(Index As Integer)
- Dim iListIndex As Integer
- Dim sItem As String
- iListIndex = drlSample.ListIndex
- Select Case Index
- ' Remove current item.
- Case 0
- If iListIndex > -1 Then
- drlSample.RemoveItem iListIndex
- ' select a new item
- If drlSample.ListCount > -1 Then drlSample.ListIndex = 0
- End If
- ' Add new item after current item.
- Case 1
- sItem = txtAdd.Text
- drlSample.AddItem sItem, iListIndex + 1
- drlSample.ListIndex = iListIndex + 1
-
- ' Exit.
- Case 2
- Unload Me
-
- ' Search.
- Case 3
- sItem = txtSearch.Text
- ' InString search -
- ' Finds text anywhere within string.
- If chkSearch.Value Then
- drlSample.FindInstr = sItem
- ' Regular search -
- ' Finds text only at beginning of string.
- Else
- drlSample.FindString = sItem
- End If
-
- ' Move to item if found.
- iListIndex = drlSample.FoundIndex
- If iListIndex <> -1 Then
- drlSample.ListIndex = iListIndex
- Else
- MsgBox "No match found.", 0, "Search"
- End If
-
- End Select
- End Sub
- Private Sub drlSample_Change()
- ' Display current item in label
- ' denoting item to remove.
- lblRemove.Caption = drlSample.Drive
- End Sub
- Private Sub drlSample_Click()
- drlSample_Change
- End Sub
- Private Sub Form_Load()
- LoadCaptions
- ' center form to screen
- Move Abs(Screen.Width - Width) \ 2, Abs(Screen.Height - Height) \ 2
- End Sub
- Private Sub optDrive_Click(Index As Integer)
- Dim iCount As Integer
- Dim iListCount As Integer
- iListCount = drlSample.ListCount
- ' Defer redrawing the control until after
- ' all pictures have been loaded or unloaded.
- drlSample.Screenupdate = False
- Select Case Index
- ' No pictures.
- Case 0
- drlSample.DefaultPics = 0
- For iCount = 0 To iListCount - 1
- drlSample.ListPicture(iCount) = LoadPicture("")
- drlSample.ListPictureSel(iCount) = LoadPicture("")
- Next
- ' Default pictures.
- Case 1
- drlSample.DefaultPics = 1
- ' Custom pictures (same for each list item).
- Case 2
- drlSample.DefaultPics = 0
- drlSample.PictureHeight = 16
- drlSample.PictureWidth = 28
- For iCount = 0 To iListCount - 1
- drlSample.ListPicture(iCount) = imgDrive(0).Picture
- drlSample.ListPictureSel(iCount) = imgDrive(1).Picture
- Next
- End Select
-
- ' Redraw control now that all pictures
- ' have been changed.
- drlSample.Screenupdate = True
- End Sub
- Private Sub txtAdd_GotFocus()
- ' Select all text.
- txtAdd.SelStart = 0
- txtAdd.SelLength = Len(txtAdd.Text)
- ' Make search button default.
- cmdAction(1).Default = True
- End Sub
- Private Sub txtAdd_LostFocus()
- ' Search button no longer default.
- cmdAction(1).Default = False
- End Sub
- Private Sub txtSearch_GotFocus()
- ' Select all text.
- txtSearch.SelStart = 0
- txtSearch.SelLength = Len(txtSearch.Text)
- ' Make search button default.
- cmdAction(3).Default = True
- End Sub
- Private Sub txtSearch_LostFocus()
- ' Search button no longer default.
- cmdAction(3).Default = False
- End Sub
-