home *** CD-ROM | disk | FTP | other *** search
- Type ListViewSample From Application
- Dim AccessControl As New ACL
- End Type
-
- Type ListForm From SampleMasterForm
- Type ListView1 From ListView
- Dim Column1 As New ColumnHeader
- Dim Column2 As New ColumnHeader
- Dim Column3 As New ColumnHeader
- Dim font1 As New Font
-
- ' METHODS for object: ListForm.ListView1
- Sub Column1_ColumnClick()
- Sorted = False
- SortOrder = IIf(SortKey = 0, 1 - SortOrder, "Ascending")
- SortType = "Alphabetic"
- SortKey = 0
- Sorted = True
- End Sub
-
- Sub Column2_ColumnClick()
- Sorted = False
- SortOrder = IIf(SortKey = 1, 1 - SortOrder, "Ascending")
- SortType = "Numeric"
- SortKey = 1
- Sorted = True
- End Sub
-
- Sub Column3_ColumnClick()
- Sorted = False
- SortOrder = IIf(SortKey = 2, 1 - SortOrder, "Ascending")
- SortType = "Date"
- SortKey = 2
- Sorted = True
- End Sub
-
- Function SortItem(item1 As String, item2 As String) As Integer
- If (SortKey = 1) Then
- dim res as integer
- res = Val(item1) < Val(item2)
- If res = 0 Then res = IIf(Val(item1) = Val(item2), 0, 1)
- SortItem = res
- ElseIf (SortKey = 2) Then
- SortItem = StrComp(Right(item1, 4) & Left(item1, 6), Right(item2, 4) & Left(item2, 6))
- End If
- End Function
-
- End Type
- Type SmallImageList From ImageList
-
- ' METHODS for object: ListForm.SmallImageList
- Sub Clear
- While Count > 0
- RemoveImage(0)
- Wend
- End Sub
-
- End Type
- Dim LargeImageList As New ListForm.SmallImageList
- Dim PictureBox1 As New PictureBox
- Dim PictureBox2 As New PictureBox
- Dim PictureBox3 As New PictureBox
- Dim cbView As New ComboBox
- Dim BmpLGAudio As New Bitmap
- Dim BmpLGArtwrx As New Bitmap
- Dim BmpLGBinary As New Bitmap
- Dim BmpLGText As New Bitmap
- Dim BmpSMText As New Bitmap
- Dim BmpSMBinary As New Bitmap
- Dim BmpSMAudio As New Bitmap
- Dim BmpSMArtwrx As New Bitmap
- Type FakeFile
- Dim FileName As String
- Dim Size As Long
- Dim Date As String
- End Type
- Type FalseDirectory
- Dim FakeFile1 As New ListForm.FakeFile
- Dim FakeFile2 As New ListForm.FakeFile
- Dim FakeFile3 As New ListForm.FakeFile
- Dim FakeFile4 As New ListForm.FakeFile
- Dim FakeFile5 As New ListForm.FakeFile
- Dim FakeFile6 As New ListForm.FakeFile
- Dim FakeFile7 As New ListForm.FakeFile
- Dim FakeFile8 As New ListForm.FakeFile
- Dim FakeFile9 As New ListForm.FakeFile
- Dim FakeFile10 As New ListForm.FakeFile
- Dim FakeFile11 As New ListForm.FakeFile
- Dim FakeFile12 As New ListForm.FakeFile
- End Type
- Dim PictureBox4 As New PictureBox
-
- ' METHODS for object: ListForm
- Sub AddColumn()
- dim name as string
- name = UniqueEmbedName(ListView1, "Column")
- ColumnHeader.Caption = Right(name, 1)
- ColumnHeader.Width = 40 * 15
- EmbedObject(ListView1, ColumnHeader, name)
- End Sub
-
- Sub cbView_Click()
- ListView1.View = cbView.Text
- End Sub
-
- Sub Clear_ColumnHeaders()
- dim ch as ColumnHeader
- For Each ch EmbeddedIn ListView1
- DestroyObject(ch)
- Next
- UnloadForm
- Show
- End Sub
-
- Sub FillListView()
- Dim o as ListForm.FakeFile
- Dim item as ListItem
- Dim index as Integer
- ListView1.Clear
- For Each o EmbeddedIn ListForm.FalseDirectory
- Select Case Right$(o.FileName, 4)
- Case ".txt"
- index = ListView1.AddItem(0, o.FileName, 3, 3)
- item = ListView1.Item(index)
- item.SmallIcon = 3
- Case ".bmp"
- index = ListView1.AddItem(0, o.FileName, 0, 0)
- item = ListView1.Item(index)
- item.SmallIcon = 0
- Case ".wav"
- index = ListView1.AddItem(0, o.FileName, 1, 1)
- item = ListView1.Item(index)
- item.SmallIcon = 1
- Case ".bin"
- index = ListView1.AddItem(0, o.FileName, 2, 2)
- item = ListView1.Item(index)
- item.SmallIcon = 2
- End Select
- item.SetSubItem(1, o.Size & " bytes")
- item.SetSubItem(2, o.Date)
- Select Case Right$(o.FileName, 4)
- Case ".txt"
- item.SmallIcon = 3
- Case ".bmp"
- item.SmallIcon = 0
- Case ".wav"
- item.SmallIcon = 1
- Case ".bin"
- item.SmallIcon = 2
- End Select
- Next o
- End Sub
-
- Sub Load()
- SmallImageList.Clear
- SmallImageList.AddBitmapsMasked(BmpSMArtwrx, 255)
- SmallImageList.AddBitmapsMasked(BmpSMAudio, 255)
- SmallImageList.AddBitmapsMasked(BmpSMBinary, 255)
- SmallImageList.AddBitmapsMasked(BmpSMText, 255)
- LargeImageList.Clear
- LargeImageList.AddBitmapsMasked(BmpLGArtwrx, 255)
- LargeImageList.AddBitmapsMasked(BmpLGAudio, 255)
- LargeImageList.AddBitmapsMasked(BmpLGBinary, 255)
- LargeImageList.AddBitmapsMasked(BmpLGText, 255)
- ListView1.SmallIcons = SmallImageList
- ListView1.LargeIcons = LargeImageList
-
- cbView.Clear
- cbView.AddItem("0 - Icon")
- cbView.AddItem("1 - SmallIcon")
- cbView.AddItem("2 - List")
- cbView.AddItem("3 - Report")
- cbView.ListIndex = 3
- End Sub
-
- Sub PictureBox1_Paint()
- With LargeImageList
- If .Count Then
- .Draw(0, PictureBox1.hDC, 0, 0, 0)
- End If
- End With
- End Sub
-
- Sub PictureBox2_Paint()
- With LargeImageList
- If .Count Then
- .Draw(1, PictureBox2.hDC, 0, 0, 0)
- End If
- End With
- End Sub
-
- Sub PictureBox3_Paint()
- With LargeImageList
- If .Count Then
- .Draw(2, PictureBox3.hDC, 0, 0, 0)
- End If
- End With
- End Sub
-
- Sub PictureBox4_Paint()
- With LargeImageList
- If .Count Then
- .Draw(3, PictureBox4.hDC, 0, 0, 0)
- End If
- End With
- End Sub
-
- Sub ResetApplication_Click ()
- FillListView
- cbView.ListIndex = 3 ' Report View
- With ListView1
- .Sorted = False
- .SortKey = 0 ' FileColumn
- .SortOrder = 0 ' Ascending
- .SortType = 0 ' Alphabetic
- .Sorted = True
- End With
- End Sub
-
- Sub Resize()
- ListView1.Move(ListView1.Left, ListView1.Top, ScaleWidth - 260, ScaleHeight - 900)
- PictureBox1.Top = ScaleHeight - PictureBox1.Height - 75
- PictureBox2.Top = PictureBox1.Top
- PictureBox3.Top = PictureBox1.Top
- PictureBox4.Top = PictureBox1.Top
-
- cbView.Top = PictureBox1.Top ' - (cbView.Height - PictureBox1.Height)
- cbView.Left = ScaleWidth - 75 - cbView.Width
-
- ListView1.Column1.Width = ListView1.Width * 0.5
- ListView1.Column2.Width = ListView1.Width * 0.25
- ListView1.Column3.Width = ListView1.Width * 0.25 - 17 * 15 ' Account for scrollbar
-
- End Sub
-
- End Type
-
- Begin Code
- ' Reconstruction commands for object: ListViewSample
- '
- With ListViewSample
- .ModulePath := "base.ebo;win32.ebo;dialogs.ebo;tools.ebo;envelop.ebo;listview.eto"
- .ProjectFileName := "C:\Current\listview\ListView.epj"
- .MainForm := ListForm
- .Path := "C:\Current\listview\"
- .EXEName := "ListView"
- With .AccessControl
- .ObjectAccess := "R,W,C,M,P"
- End With 'ListViewSample.AccessControl
- End With 'ListViewSample
- ' Reconstruction commands for object: ListForm
- '
- With ListForm
- .Caption := "ListView Sample"
- .Move(4890, 1470, 7530, 7245)
- .CurrentY := 480
- .BorderStyle := "Fixed Double"
- .MaxButton := False
- .MinButton := False
- .SampleDir := "C:\Current\listview\"
- .SampleName := "listview"
- With .ListView1
- .ForeColor := 0
- .Font := ListForm.ListView1.font1
- .ZOrder := 6
- .Move(150, 150, 7180, 5640)
- .View := "Report"
- .Sorted := True
- .SmallIcons := ListForm.SmallImageList
- .LargeIcons := ListForm.LargeImageList
- With .Column1
- .Width := 3585
- .Caption := "FileName"
- End With 'ListForm.ListView1.Column1
- With .Column2
- .Width := 1785
- .Caption := "Size"
- End With 'ListForm.ListView1.Column2
- With .Column3
- .Alignment := "Center"
- .Width := 1530
- .Caption := "Date"
- End With 'ListForm.ListView1.Column3
- With .font1
- .FaceName := "Arial"
- .Size := 9.000000
- .Bold := False
- .Italic := True
- .Strikethru := False
- End With 'ListForm.ListView1.font1
- End With 'ListForm.ListView1
- With .SmallImageList
- .ImageWidth := 16
- .ImageHeight := 16
- End With 'ListForm.SmallImageList
- With .LargeImageList
- .ImageWidth := 32
- .ImageHeight := 32
- End With 'ListForm.LargeImageList
- With .PictureBox1
- .Caption := "PictureBox1"
- .ZOrder := 5
- .Move(150, 5865, 600, 600)
- End With 'ListForm.PictureBox1
- With .PictureBox2
- .Caption := "PictureBox2"
- .ZOrder := 4
- .Move(900, 5865, 600, 600)
- End With 'ListForm.PictureBox2
- With .PictureBox3
- .Caption := "PictureBox3"
- .ZOrder := 3
- .Move(1650, 5865, 600, 600)
- End With 'ListForm.PictureBox3
- With .cbView
- .ZOrder := 2
- .Move(5415, 5865, 1950, 360)
- .Sorted := False
- End With 'ListForm.cbView
- With .BmpLGAudio
- .LoadType := "MemoryBased"
- .FileName := "listview.ero"
- .ResId := 0
- End With 'ListForm.BmpLGAudio
- With .BmpLGArtwrx
- .LoadType := "MemoryBased"
- .FileName := "listview.ero"
- .ResId := 628
- End With 'ListForm.BmpLGArtwrx
- With .BmpLGBinary
- .LoadType := "MemoryBased"
- .FileName := "listview.ero"
- .ResId := 1256
- End With 'ListForm.BmpLGBinary
- With .BmpLGText
- .LoadType := "MemoryBased"
- .FileName := "listview.ero"
- .ResId := 1884
- End With 'ListForm.BmpLGText
- With .BmpSMText
- .LoadType := "MemoryBased"
- .FileName := "listview.ero"
- .ResId := 2512
- End With 'ListForm.BmpSMText
- With .BmpSMBinary
- .LoadType := "MemoryBased"
- .FileName := "listview.ero"
- .ResId := 2760
- End With 'ListForm.BmpSMBinary
- With .BmpSMAudio
- .LoadType := "MemoryBased"
- .FileName := "listview.ero"
- .ResId := 3004
- End With 'ListForm.BmpSMAudio
- With .BmpSMArtwrx
- .LoadType := "MemoryBased"
- .FileName := "listview.ero"
- .ResId := 3248
- End With 'ListForm.BmpSMArtwrx
- With .FakeFile
- .FileName := ""
- .Size := 0
- .Date := ""
- End With 'ListForm.FakeFile
- With .FalseDirectory
- With .FakeFile1
- .FileName := "Readme.txt"
- .Size := 314
- .Date := "05/06/1996"
- End With 'ListForm.FalseDirectory.FakeFile1
- With .FakeFile2
- .FileName := "Thoughts.txt"
- .Size := 38016
- .Date := "05/03/1996"
- End With 'ListForm.FalseDirectory.FakeFile2
- With .FakeFile3
- .FileName := "TheTruth.txt"
- .Size := 10
- .Date := "03/18/1996"
- End With 'ListForm.FalseDirectory.FakeFile3
- With .FakeFile4
- .FileName := "Gambit.txt"
- .Size := 2965
- .Date := "04/18/1995"
- End With 'ListForm.FalseDirectory.FakeFile4
- With .FakeFile5
- .FileName := "GCanyon.bmp"
- .Size := 168594
- .Date := "11/14/1995"
- End With 'ListForm.FalseDirectory.FakeFile5
- With .FakeFile6
- .FileName := "Muppets.bmp"
- .Size := 216859
- .Date := "12/25/1995"
- End With 'ListForm.FalseDirectory.FakeFile6
- With .FakeFile7
- .FileName := "Nagel14.bmp"
- .Size := 94853
- .Date := "02/23/1996"
- End With 'ListForm.FalseDirectory.FakeFile7
- With .FakeFile8
- .FileName := "Geekie.bin"
- .Size := 16855
- .Date := "05/07/1996"
- End With 'ListForm.FalseDirectory.FakeFile8
- With .FakeFile9
- .FileName := "Adecodr.bin"
- .Size := 11526
- .Date := "01/06/1994"
- End With 'ListForm.FalseDirectory.FakeFile9
- With .FakeFile10
- .FileName := "Tim2Rock.wav"
- .Size := 32994
- .Date := "02/18/1996"
- End With 'ListForm.FalseDirectory.FakeFile10
- With .FakeFile11
- .FileName := "Splitch.wav"
- .Size := 66794
- .Date := "05/18/1996"
- End With 'ListForm.FalseDirectory.FakeFile11
- With .FakeFile12
- .FileName := "NotToday.wav"
- .Size := 108649
- .Date := "05/19/1996"
- End With 'ListForm.FalseDirectory.FakeFile12
- End With 'ListForm.FalseDirectory
- With .PictureBox4
- .Caption := "PictureBox4"
- .ZOrder := 1
- .Move(2400, 5865, 600, 600)
- End With 'ListForm.PictureBox4
- With .helpfile
- .FileName := "C:\Current\listview\listview.hlp"
- End With 'ListForm.helpfile
- End With 'ListForm
- End Code
-