VERSION 5.00 Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX" Begin VB.Form frmSelection Caption = "Trendauswahl" ClientHeight = 4710 ClientLeft = 60 ClientTop = 345 ClientWidth = 6735 LinkTopic = "Form1" ScaleHeight = 4710 ScaleWidth = 6735 StartUpPosition = 2 'Bildschirmmitte Begin VB.CommandButton cmdAbort Caption = "Abbrechen" Height = 525 Left = 3720 TabIndex = 9 Top = 4140 Width = 1245 End Begin VB.CommandButton cmdOK Caption = "OK" Height = 525 Left = 1800 TabIndex = 8 Top = 4140 Width = 1245 End Begin VB.CommandButton cmdRemoveAll Caption = "<<" BeginProperty Font Name = "MS Sans Serif" Size = 13.5 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 525 Left = 3120 TabIndex = 7 Top = 2790 Width = 525 End Begin VB.CommandButton cmdRemove Caption = "<" BeginProperty Font Name = "MS Sans Serif" Size = 13.5 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 525 Left = 3120 TabIndex = 6 Top = 2130 Width = 525 End Begin VB.CommandButton cmdAddAll Caption = ">>" BeginProperty Font Name = "MS Sans Serif" Size = 13.5 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 525 Left = 3120 TabIndex = 5 Top = 1470 Width = 525 End Begin VB.CommandButton cmdAdd Caption = ">" BeginProperty Font Name = "MS Sans Serif" Size = 13.5 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 525 Left = 3120 TabIndex = 4 Top = 810 Width = 525 End Begin VB.Frame fraSelected Caption = "Ausgewählte Trends" Height = 4065 Left = 3720 TabIndex = 1 Top = 0 Width = 3015 Begin MSComctlLib.ListView lvwSelected Height = 3750 Left = 90 TabIndex = 10 Top = 240 Width = 2850 _ExtentX = 5027 _ExtentY = 6615 View = 3 LabelWrap = -1 'True HideSelection = -1 'True _Version = 393217 ForeColor = -2147483640 BackColor = -2147483643 BorderStyle = 1 Appearance = 1 NumItems = 2 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Trend" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 1 Text = "Archiv" Object.Width = 2540 EndProperty End End Begin VB.Frame fraAll Caption = "Vorhandene Trends:" Height = 4065 Left = 0 TabIndex = 0 Top = 0 Width = 3015 Begin VB.ComboBox cboArchives Height = 315 Left = 90 Style = 2 'Dropdown-Liste TabIndex = 3 Top = 3660 Width = 2835 End Begin VB.ListBox lstAll Height = 3360 IntegralHeight = 0 'False Left = 90 TabIndex = 2 Top = 240 Width = 2835 End End End Attribute VB_Name = "frmSelection" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Dim vTrends As Variant Dim vArchives As Variant Dim vwTrend As VWSTrendBrowser Dim tProp As VWSTrendProperties Private Sub cboArchives_Click() Dim bExists As Boolean Dim i As Integer Dim j As Integer Dim iSize As Long Set vwTrend = New VWSTrendBrowser iSize = vwTrend.EnumTrends(cboArchives.List(cboArchives.ListIndex), vTrends) lstAll.Clear For i = 0 To iSize - 1 bExists = False For j = 0 To lvwSelected.ListItems.Count - 1 If lvwSelected.ListItems(j + 1) = vTrends(i) Then If lvwSelected.ListItems(j + 1).SubItems(1) = cboArchives.List(cboArchives.ListIndex) Then bExists = True End If End If Next j If bExists = False Then lstAll.AddItem vTrends(i) End If Next i End Sub Private Sub cmdAbort_Click() Unload Me End Sub Private Sub cmdAdd_Click() If lstAll.ListIndex = -1 Then Exit Sub If lvwSelected.ListItems.Count = 8 Then MsgBox "Sie haben bereits 8 Trends ausgewählt!" Exit Sub End If lvwSelected.ListItems.Add , , lstAll.List(lstAll.ListIndex) lvwSelected.ListItems(lvwSelected.ListItems.Count).SubItems(1) = cboArchives.List(cboArchives.ListIndex) lstAll.RemoveItem lstAll.ListIndex End Sub Private Sub cmdAddAll_Click() Dim i As Integer If lstAll.ListCount = 0 Then Exit Sub For i = 0 To lstAll.ListCount - 1 If lvwSelected.ListItems.Count = 8 Then MsgBox "Die restlichen Trends konnten nicht übernommen werden, da schon 8 Trends ausgewählt sind!" Exit Sub End If lvwSelected.ListItems.Add , , lstAll.List(0) lstAll.RemoveItem (0) lvwSelected.ListItems(lvwSelected.ListItems.Count).SubItems(1) = cboArchives.List(cboArchives.ListIndex) Next i End Sub Private Sub cmdOK_Click() Dim i As Integer Dim m As String Dim max As Double Dim s As String Dim bFlag As Boolean bFlag = True If lvwSelected.ListItems.Count = 0 Then bFlag = False End If For i = 1 To 8 s = "Archive" & i CallByName frmTrendSelection.trdDummy, s, VbLet, "" s = "Trend" & i CallByName frmTrendSelection.trdDummy, s, VbLet, "" Next i If bFlag = True Then For i = 0 To lvwSelected.ListItems.Count - 1 s = "Archive" & i + 1 CallByName frmTrendSelection.trdDummy, s, VbLet, lvwSelected.ListItems(i + 1).SubItems(1) s = "Trend" & i + 1 CallByName frmTrendSelection.trdDummy, s, VbLet, lvwSelected.ListItems.Item(i + 1).Text Set tProp = vwTrend.TrendInfo(lvwSelected.ListItems(i + 1).SubItems(1), lvwSelected.ListItems.Item(i + 1).Text) m = "MaxValue" & i + 1 CallByName frmTrendSelection.trdDummy, m, VbLet, tProp.Maximum Next i End If frmTrendSelection.trdDummy.ApplyChanges frmTrendSelection.legTrends.ApplyChanges Unload Me End Sub Private Sub cmdRemove_Click() If lvwSelected.ListItems.Count = 0 Then Exit Sub If lvwSelected.SelectedItem.SubItems(1) = cboArchives.List(cboArchives.ListIndex) Then lstAll.AddItem lvwSelected.SelectedItem.Text End If lvwSelected.ListItems.Remove lvwSelected.SelectedItem.Index End Sub Private Sub cmdRemoveAll_Click() Dim i As Integer If lvwSelected.ListItems.Count = 0 Then Exit Sub For i = 1 To lvwSelected.ListItems.Count If lvwSelected.ListItems(i).SubItems(1) = cboArchives.List(cboArchives.ListIndex) Then lstAll.AddItem lvwSelected.ListItems(i).Text End If Next i lvwSelected.ListItems.Clear End Sub Private Sub Form_Activate() Dim i As Integer Dim iSize As Long Set vwTrend = New VWSTrendBrowser iSize = vwTrend.EnumArchives(vArchives) For i = 0 To iSize - 1 cboArchives.AddItem vArchives(i) Next i FillListView cboArchives.ListIndex = 0 lvwSelected.ColumnHeaders(1).Width = lvwSelected.ColumnHeaders(1).Width - 120 End Sub Private Sub Form_Load() Set curFrm = Me End Sub Private Sub lstAll_DblClick() cmdAdd_Click End Sub Private Sub FillListView() Dim i As Integer Dim j As Integer Dim k As Integer Dim iSize As Long Dim s As String Dim sRet As String Dim t As String Dim tRet As String Set vwTrend = New VWSTrendBrowser For i = 1 To 8 s = "Trend" & i t = "Archive" & i sRet = CallByName(frmTrendSelection.trdDummy, s, VbGet) tRet = CallByName(frmTrendSelection.trdDummy, t, VbGet) For j = 0 To cboArchives.ListCount - 1 iSize = vwTrend.EnumTrends(cboArchives.List(j), vTrends) For k = 0 To iSize - 1 If vTrends(k) = sRet Then lvwSelected.ListItems.Add , , sRet lvwSelected.ListItems(i).SubItems(1) = tRet End If Next k Next j Next i End Sub Private Sub lvwSelected_DblClick() cmdRemove_Click End Sub