home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 March / VPR9703A.ISO / MS_DEV / VBCCE / SAMPLES / AXLstPck / AXLstPck.EXE / RCDATA / CABINET / AXLstPik.ctl < prev    next >
Text File  |  1996-10-22  |  22KB  |  731 lines

  1. VERSION 5.00
  2. Begin VB.UserControl AXListPicker 
  3.    ClientHeight    =   1785
  4.    ClientLeft      =   0
  5.    ClientTop       =   0
  6.    ClientWidth     =   5790
  7.    LockControls    =   -1  'True
  8.    PropertyPages   =   "AXLstPik.ctx":0000
  9.    ScaleHeight     =   1785
  10.    ScaleWidth      =   5790
  11.    ToolboxBitmap   =   "AXLstPik.ctx":002D
  12.    Begin VB.ListBox lstSource 
  13.       Height          =   1455
  14.       Index           =   0
  15.       Left            =   60
  16.       TabIndex        =   1
  17.       Top             =   255
  18.       Width           =   2220
  19.    End
  20.    Begin VB.ListBox lstDestination 
  21.       Height          =   1455
  22.       Index           =   0
  23.       Left            =   2970
  24.       TabIndex        =   8
  25.       Top             =   255
  26.       Width           =   2220
  27.    End
  28.    Begin VB.CommandButton cmdRightOne 
  29.       BeginProperty Font 
  30.          Name            =   "MS Sans Serif"
  31.          Size            =   9.75
  32.          Charset         =   0
  33.          Weight          =   700
  34.          Underline       =   0   'False
  35.          Italic          =   0   'False
  36.          Strikethrough   =   0   'False
  37.       EndProperty
  38.       Height          =   336
  39.       Left            =   2340
  40.       Picture         =   "AXLstPik.ctx":01AF
  41.       Style           =   1  'Graphical
  42.       TabIndex        =   3
  43.       Top             =   240
  44.       UseMaskColor    =   -1  'True
  45.       Width           =   576
  46.    End
  47.    Begin VB.CommandButton cmdRightAll 
  48.       BeginProperty Font 
  49.          Name            =   "MS Sans Serif"
  50.          Size            =   9.75
  51.          Charset         =   0
  52.          Weight          =   700
  53.          Underline       =   0   'False
  54.          Italic          =   0   'False
  55.          Strikethrough   =   0   'False
  56.       EndProperty
  57.       Height          =   336
  58.       Left            =   2340
  59.       Picture         =   "AXLstPik.ctx":02B1
  60.       Style           =   1  'Graphical
  61.       TabIndex        =   4
  62.       Top             =   615
  63.       UseMaskColor    =   -1  'True
  64.       Width           =   576
  65.    End
  66.    Begin VB.CommandButton cmdLeftOne 
  67.       BeginProperty Font 
  68.          Name            =   "MS Sans Serif"
  69.          Size            =   9.75
  70.          Charset         =   0
  71.          Weight          =   700
  72.          Underline       =   0   'False
  73.          Italic          =   0   'False
  74.          Strikethrough   =   0   'False
  75.       EndProperty
  76.       Height          =   336
  77.       Left            =   2340
  78.       Picture         =   "AXLstPik.ctx":03B3
  79.       Style           =   1  'Graphical
  80.       TabIndex        =   5
  81.       Top             =   990
  82.       UseMaskColor    =   -1  'True
  83.       Width           =   576
  84.    End
  85.    Begin VB.CommandButton cmdLeftAll 
  86.       BeginProperty Font 
  87.          Name            =   "MS Sans Serif"
  88.          Size            =   9.75
  89.          Charset         =   0
  90.          Weight          =   700
  91.          Underline       =   0   'False
  92.          Italic          =   0   'False
  93.          Strikethrough   =   0   'False
  94.       EndProperty
  95.       Height          =   336
  96.       Left            =   2340
  97.       Picture         =   "AXLstPik.ctx":04B5
  98.       Style           =   1  'Graphical
  99.       TabIndex        =   6
  100.       Top             =   1365
  101.       UseMaskColor    =   -1  'True
  102.       Width           =   576
  103.    End
  104.    Begin VB.CommandButton cmdUp 
  105.       Enabled         =   0   'False
  106.       Height          =   435
  107.       Left            =   5265
  108.       Picture         =   "AXLstPik.ctx":05B7
  109.       Style           =   1  'Graphical
  110.       TabIndex        =   10
  111.       Top             =   465
  112.       UseMaskColor    =   -1  'True
  113.       Width           =   435
  114.    End
  115.    Begin VB.CommandButton cmdDown 
  116.       Enabled         =   0   'False
  117.       Height          =   435
  118.       Left            =   5280
  119.       Picture         =   "AXLstPik.ctx":06B9
  120.       Style           =   1  'Graphical
  121.       TabIndex        =   11
  122.       Top             =   1050
  123.       UseMaskColor    =   -1  'True
  124.       Width           =   435
  125.    End
  126.    Begin VB.ListBox lstDestination 
  127.       Height          =   1455
  128.       Index           =   1
  129.       Left            =   2970
  130.       Sorted          =   -1  'True
  131.       TabIndex        =   9
  132.       Top             =   255
  133.       Visible         =   0   'False
  134.       Width           =   2220
  135.    End
  136.    Begin VB.ListBox lstSource 
  137.       Height          =   1455
  138.       Index           =   1
  139.       Left            =   60
  140.       Sorted          =   -1  'True
  141.       TabIndex        =   2
  142.       Top             =   255
  143.       Visible         =   0   'False
  144.       Width           =   2220
  145.    End
  146.    Begin VB.Label lblSource 
  147.       Appearance      =   0  'Flat
  148.       AutoSize        =   -1  'True
  149.       BackColor       =   &H80000005&
  150.       BackStyle       =   0  'Transparent
  151.       Caption         =   "&Source:"
  152.       ForeColor       =   &H80000008&
  153.       Height          =   195
  154.       Left            =   60
  155.       TabIndex        =   0
  156.       Tag             =   "2406"
  157.       Top             =   15
  158.       Width           =   555
  159.    End
  160.    Begin VB.Label lblDestination 
  161.       Appearance      =   0  'Flat
  162.       AutoSize        =   -1  'True
  163.       BackColor       =   &H80000005&
  164.       BackStyle       =   0  'Transparent
  165.       Caption         =   "&Destination:"
  166.       ForeColor       =   &H80000008&
  167.       Height          =   195
  168.       Left            =   2970
  169.       TabIndex        =   7
  170.       Tag             =   "2407"
  171.       Top             =   15
  172.       Width           =   840
  173.    End
  174. End
  175. Attribute VB_Name = "AXListPicker"
  176. Attribute VB_GlobalNameSpace = False
  177. Attribute VB_Creatable = True
  178. Attribute VB_PredeclaredId = False
  179. Attribute VB_Exposed = True
  180. Attribute VB_Description = "List Picker/Mover Control"
  181. Dim msglWidth As Single
  182. Dim mnSourceList As Integer
  183. Dim mnDestinationList As Integer
  184. Dim mnSourceSortType As Integer
  185. Dim mnDestinationSortType As Integer
  186. Dim mbReadingProperties As Boolean
  187.  
  188. Const CTL_WIDTH1 = 5265
  189. Const CTL_WIDTH2 = 5820
  190.  
  191. '================================================================
  192. ' Enums
  193. '================================================================
  194. Public Enum lspSourceSortType
  195.   lspSTSourceUnsorted
  196.   lspSTSourceSorted
  197. End Enum
  198.  
  199. Public Enum lspDestinationSortType
  200.   lspSTDestinationUnsorted
  201.   lspSTDestinationSorted
  202.   lspSTOrderButtons
  203. End Enum
  204.  
  205. Public Enum lspListCountConstants
  206.   lspSource
  207.   lspDesintation
  208.   lspAll
  209. End Enum
  210.  
  211. Public Enum lspControlsType
  212.   lspCTSource
  213.   lspCTDestination
  214.   lspCTAddAll
  215.   lspCTAddOne
  216.   lspCTRemoveAll
  217.   lspCTRemoveOne
  218.   lspCTOrderUp
  219.   lspCTOrderDown
  220.   lspCTNone
  221. End Enum
  222.  
  223. Public Enum lspListIndex
  224.   lspSourceList
  225.   lspDestinationList
  226. End Enum
  227.  
  228. '================================================================
  229. ' Event Declarations
  230. '================================================================
  231. Event MoveToDestination(Cancel As Boolean, Count As Integer)
  232. Event MoveToSource(Cancel As Boolean, Count As Integer)
  233.  
  234. '================================================================
  235. ' Design Time/Runtime Public Properties
  236. '================================================================
  237.  
  238. Public Property Let SourceCaption(ByVal sVal As String)
  239.   lblSource.Caption = sVal
  240.   PropertyChanged "SourceCaption"
  241. End Property
  242.  
  243. Public Property Get SourceCaption() As String
  244.   SourceCaption = lblSource.Caption
  245. End Property
  246.  
  247. Public Property Let DestinationCaption(ByVal sVal As String)
  248.   lblDestination.Caption = sVal
  249.   PropertyChanged "DestinationCaption"
  250. End Property
  251.  
  252. Public Property Get DestinationCaption() As String
  253.   DestinationCaption = lblDestination.Caption
  254. End Property
  255.  
  256. Public Property Get SourceSortType() As lspSourceSortType
  257.   SourceSortType = mnSourceSortType
  258. End Property
  259.  
  260. Public Property Let SourceSortType(ByVal nVal As lspSourceSortType)
  261.   'disallow at run time
  262.   If Ambient.UserMode And (Not mbReadingProperties) Then
  263.     MsgBox Error(382)
  264.     Exit Property
  265.   End If
  266.   
  267.   If nVal = lspSTSourceUnsorted Then
  268.     lstSource(1).Visible = False
  269.     lstSource(0).Visible = True
  270.   ElseIf nVal = lspSTSourceSorted Then
  271.     lstSource(0).Visible = False
  272.     lstSource(1).Visible = True
  273.   Else
  274.     MsgBox Error(380)
  275.     Exit Property
  276.   End If
  277.   mnSourceSortType = nVal
  278.   mnSourceList = nVal
  279.   PropertyChanged "SourceSortType"
  280. End Property
  281.  
  282. Public Property Get DestinationSortType() As lspDestinationSortType
  283.   DestinationSortType = mnDestinationSortType
  284. End Property
  285.  
  286. Public Property Let DestinationSortType(ByVal nVal As lspDestinationSortType)
  287.   On Error GoTo DestinationSortTypeErr
  288.   'disallow at run time
  289.   If Ambient.UserMode And (Not mbReadingProperties) Then
  290.     MsgBox Error(382)
  291.     Exit Property
  292.   End If
  293.   
  294.   If nVal = lspSTDestinationSorted Then   'sorted
  295.     lstDestination(0).Visible = False
  296.     lstDestination(1).Visible = True
  297.     mnDestinationList = 1
  298.     msglWidth = CTL_WIDTH1
  299.   ElseIf nVal = lspSTOrderButtons Or nVal = lspSTDestinationUnsorted Then
  300.     lstDestination(1).Visible = False
  301.     lstDestination(0).Visible = True
  302.     mnDestinationList = 0
  303.     If nVal = lspSTDestinationUnsorted Then
  304.       msglWidth = CTL_WIDTH1
  305.       cmdUp.Enabled = False
  306.       cmdDown.Enabled = False
  307.     Else
  308.       'show the order buttons
  309.       msglWidth = CTL_WIDTH2
  310.       cmdUp.Enabled = True
  311.       cmdDown.Enabled = True
  312.     End If
  313.   Else
  314.     MsgBox Error(380)
  315.   End If
  316.   
  317.   mnDestinationSortType = nVal
  318.   UserControl_Resize
  319.   PropertyChanged "DestinationSortType"
  320.   
  321.   Exit Property
  322. DestinationSortTypeErr:
  323.   MsgBox Err.Description
  324. End Property
  325.  
  326. Public Property Get BackColor() As OLE_COLOR
  327.   BackColor = UserControl.BackColor
  328. End Property
  329.  
  330. Public Property Let BackColor(ByVal vNewValue As OLE_COLOR)
  331.   UserControl.BackColor = vNewValue
  332.   PropertyChanged "BackColor"
  333. End Property
  334.  
  335. Public Property Get ListColor() As OLE_COLOR
  336.   ListColor = lstSource(0).BackColor
  337. End Property
  338.  
  339. Public Property Let ListColor(ByVal vNewValue As OLE_COLOR)
  340.   lstSource(0).BackColor = vNewValue
  341.   lstSource(1).BackColor = vNewValue
  342.   lstDestination(0).BackColor = vNewValue
  343.   lstDestination(1).BackColor = vNewValue
  344.   PropertyChanged "ListColor"
  345. End Property
  346.  
  347. Public Property Get ListBoxFont() As Font
  348.   Set ListBoxFont = lstSource(0).Font
  349. End Property
  350.  
  351. Public Property Set ListBoxFont(ByVal vNewValue As Font)
  352.   Set lstSource(0).Font = vNewValue
  353.   Set lstSource(1).Font = vNewValue
  354.   Set lstDestination(0).Font = vNewValue
  355.   Set lstDestination(1).Font = vNewValue
  356.   PropertyChanged "ListBoxFont"
  357. End Property
  358.  
  359. Public Property Get LabelFont() As Font
  360.   Set LabelFont = lblSource.Font
  361. End Property
  362.  
  363. Public Property Set LabelFont(ByVal vNewValue As Font)
  364.   Set lblSource.Font = vNewValue
  365.   Set lblDestination.Font = vNewValue
  366.   PropertyChanged "LabelFont"
  367. End Property
  368.  
  369. Public Property Get Enabled() As Boolean
  370.   Enabled = UserControl.Enabled
  371. End Property
  372.  
  373. Public Property Let Enabled(ByVal vNewValue As Boolean)
  374.   Dim ctl As Control
  375.   For Each ctl In UserControl.Controls
  376.     ctl.Enabled = vNewValue
  377.   Next ctl
  378.   UserControl.Enabled = vNewValue
  379.   PropertyChanged "Enabled"
  380. End Property
  381.  
  382. '================================================================
  383. ' Property Bag Functions
  384. '================================================================
  385. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  386.   'Load property values from storage
  387.   mbReadingProperties = True
  388.   SourceCaption = PropBag.ReadProperty("SourceCaption")
  389.   DestinationCaption = PropBag.ReadProperty("DestinationCaption")
  390.   SourceSortType = PropBag.ReadProperty("SourceSortType", mnSourceSortType)
  391.   DestinationSortType = PropBag.ReadProperty("DestinationSortType", mnDestinationSortType)
  392.   BackColor = PropBag.ReadProperty("BackColor", &H8000000F)
  393.   ListColor = PropBag.ReadProperty("ListColor", &H80000005)
  394.   Set ListBoxFont = PropBag.ReadProperty("ListBoxFont")
  395.   Set LabelFont = PropBag.ReadProperty("LabelFont")
  396.   Enabled = PropBag.ReadProperty("Enabled", True)
  397. '   = PropBag.ReadProperty("", )
  398.   mbReadingProperties = False
  399. End Sub
  400.  
  401. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  402.   'Write property values to storage
  403.   Call PropBag.WriteProperty("SourceCaption", SourceCaption, "")
  404.   Call PropBag.WriteProperty("DestinationCaption", DestinationCaption, "")
  405.   Call PropBag.WriteProperty("SourceSortType", SourceSortType, 0)
  406.   Call PropBag.WriteProperty("DestinationSortType", DestinationSortType, 0)
  407.   Call PropBag.WriteProperty("BackColor", BackColor, &H8000000F)
  408.   Call PropBag.WriteProperty("ListColor", ListColor, &H80000005)
  409.   Call PropBag.WriteProperty("ListBoxFont", ListBoxFont)
  410.   Call PropBag.WriteProperty("LabelFont", LabelFont)
  411.   Call PropBag.WriteProperty("Enabled", Enabled, True)
  412. '  Call PropBag.WriteProperty("", , )
  413. End Sub
  414.  
  415. '================================================================
  416. ' Runtime Only Public Properties
  417. '================================================================
  418. Public Property Let SourceListIndex(nIndex As Integer)
  419. Attribute SourceListIndex.VB_MemberFlags = "400"
  420.   On Error Resume Next
  421.   lstSource(mnSourceList).ListIndex = nIndex
  422.   If Err Then
  423.     MsgBox Error(9)
  424.   End If
  425. End Property
  426.  
  427. Public Property Get SourceListIndex() As Integer
  428.   SourceListIndex = lstSource(mnSourceList).ListIndex
  429. End Property
  430.  
  431. Public Property Let DestinationListIndex(nIndex As Integer)
  432. Attribute DestinationListIndex.VB_MemberFlags = "400"
  433.   On Error Resume Next
  434.   lstDestination(mnDestinationList).ListIndex = nIndex
  435.   If Err Then
  436.     MsgBox Error(9)
  437.   End If
  438. End Property
  439.  
  440. Public Property Get DestinationListTopIndex() As Integer
  441. Attribute DestinationListTopIndex.VB_MemberFlags = "400"
  442.   DestinationListTopIndex = lstDestination(mnDestinationList).TopIndex
  443. End Property
  444.  
  445. Public Property Let SourceListTopIndex(nTopIndex As Integer)
  446. Attribute SourceListTopIndex.VB_MemberFlags = "400"
  447.   On Error Resume Next
  448.   lstSource(mnSourceList).TopIndex = nTopIndex
  449.   If Err Then
  450.     MsgBox Error(9)
  451.   End If
  452. End Property
  453.  
  454. Public Property Get SourceListTopIndex() As Integer
  455.   SourceListTopIndex = lstSource(mnSourceList).TopIndex
  456. End Property
  457.  
  458. Public Property Let DestinationListTopIndex(nTopIndex As Integer)
  459.   On Error Resume Next
  460.   lstDestination(mnDestinationList).ListIndex = nTopIndex
  461.   If Err Then
  462.     MsgBox Error(9)
  463.   End If
  464. End Property
  465.  
  466. Public Property Get DestinationListIndex() As Integer
  467.   DestinationListIndex = lstDestination(mnDestinationList).ListIndex
  468. End Property
  469.  
  470. Public Property Get SourceList(nIndex As Integer) As String
  471. Attribute SourceList.VB_MemberFlags = "400"
  472.   On Error GoTo SourceListErr
  473.   SourceList = lstSource(mnSourceList).List(nIndex)
  474.   Exit Property
  475. SourceListErr:
  476.   MsgBox Error
  477. End Property
  478.  
  479. Public Property Get DestinationList(nIndex As Integer) As String
  480. Attribute DestinationList.VB_MemberFlags = "400"
  481.   On Error GoTo DestinationListErr
  482.   DestinationList = lstDestination(mnDestinationList).List(nIndex)
  483.   Exit Property
  484. DestinationListErr:
  485.   MsgBox Error
  486. End Property
  487.  
  488. Public Property Get ListCount(nList As lspListCountConstants) As Long
  489. Attribute ListCount.VB_MemberFlags = "400"
  490.   If nList = lspSource Then
  491.     ListCount = lstSource(mnSourceList).ListCount
  492.   ElseIf nList = lspDesintation Then
  493.     ListCount = lstDestination(mnDestinationList).ListCount
  494.   ElseIf nList = lspAll Then
  495.     ListCount = lstSource(mnSourceList).ListCount + lstDestination(mnDestinationList).ListCount
  496.   Else
  497.     MsgBox Error(380)
  498.   End If
  499. End Property
  500.  
  501. '================================================================
  502. ' Public methods
  503. '================================================================
  504. Public Sub AddItem(sItem As String, lCtrl As lspListIndex, Optional nIndex As Variant)
  505.   On Error GoTo AddSourceItemErr
  506.  
  507.   If lCtrl = lspSourceList Then
  508.     If TypeName(nIndex) = "Integer" Then
  509.       lstSource(mnSourceList).AddItem sItem, nIndex
  510.     Else
  511.       lstSource(mnSourceList).AddItem sItem
  512.     End If
  513.   '  If lstSource(mnSourceList).ListIndex < 0 And lstSource(mnSourceList).ListCount > 0 Then
  514.       'select the first item added
  515.       lstSource(mnSourceList).ListIndex = 0
  516.   '  End If
  517.   ElseIf lCtrl = lspDestinationList Then
  518.     If TypeName(nIndex) = "Integer" Then
  519.       lstDestination(mnDestinationList).AddItem sItem, nIndex
  520.     Else
  521.       lstDestination(mnDestinationList).AddItem sItem
  522.     End If
  523.   Else
  524.     MsgBox Error(5)
  525.   End If
  526.  
  527.   Exit Sub
  528.   
  529. AddSourceItemErr:
  530.   MsgBox Error
  531. End Sub
  532.  
  533. Public Sub RemoveItem(lCtrl As lspListIndex, nIndex As Integer)
  534.   On Error GoTo RemoveSourceItemErr
  535.  
  536.   If lCtrl = lspSourceList Then
  537.     lstSource(mnSourceList).RemoveItem nIndex
  538.   ElseIf lCtrl = lspDestinationList Then
  539.     lstDestination(mnDestinationList).RemoveItem nIndex
  540.   Else
  541.     MsgBox Error(5)
  542.   End If
  543.  
  544.   Exit Sub
  545.   
  546. RemoveSourceItemErr:
  547.   MsgBox Error
  548. End Sub
  549.  
  550. Public Sub ClearSource()
  551.   lstSource(mnSourceList).Clear
  552. End Sub
  553.  
  554. Public Sub ClearDestination()
  555.   lstDestination(mnDestinationList).Clear
  556. End Sub
  557.  
  558. Public Sub ClearAll()
  559.   lstSource(mnSourceList).Clear
  560.   lstDestination(mnDestinationList).Clear
  561. End Sub
  562.  
  563. '================================================================
  564. ' Private events and support routines
  565. '================================================================
  566. Private Sub cmdUp_Click()
  567.   On Error Resume Next
  568.   Dim nItem As Integer
  569.   
  570.   With lstDestination(mnDestinationList)
  571.     If .ListIndex < 0 Then Exit Sub
  572.     nItem = .ListIndex
  573.     If nItem = 0 Then Exit Sub  'can't move 1st item up
  574.     'move item up
  575.     .AddItem .Text, nItem - 1
  576.     'remove old item
  577.     .RemoveItem nItem + 1
  578.     'select the item that was just moved
  579.     .Selected(nItem - 1) = True
  580.   End With
  581. End Sub
  582.  
  583. Private Sub cmdDown_Click()
  584.   On Error Resume Next
  585.   Dim nItem As Integer
  586.   
  587.   With lstDestination(mnDestinationList)
  588.     If .ListIndex < 0 Then Exit Sub
  589.     nItem = .ListIndex
  590.     If nItem = .ListCount - 1 Then Exit Sub 'can't move last item down
  591.     'move item down
  592.     .AddItem .Text, nItem + 2
  593.     'remove old item
  594.     .RemoveItem nItem
  595.     'select the item that was just moved
  596.     .Selected(nItem + 1) = True
  597.   End With
  598. End Sub
  599.  
  600. Private Sub cmdRightOne_Click()
  601.   On Error GoTo cmdRightOne_ClickErr
  602.   Dim i As Integer
  603.   Dim bCancel As Boolean
  604.   
  605.   If lstSource(mnSourceList).ListIndex < 0 Then Exit Sub
  606.   i = lstSource(mnSourceList).ListIndex
  607.   
  608.   'raise the event before doing the move
  609.   RaiseEvent MoveToDestination(bCancel, 1)
  610.   
  611.   If bCancel Then Exit Sub
  612.   
  613.   'go ahead and move it
  614.   lstDestination(mnDestinationList).AddItem lstSource(mnSourceList).Text
  615.   lstSource(mnSourceList).RemoveItem lstSource(mnSourceList).ListIndex
  616.   If lstSource(mnSourceList).ListCount > 0 Then
  617.     If i > lstSource(mnSourceList).ListCount - 1 Then
  618.       lstSource(mnSourceList).ListIndex = i - 1
  619.     Else
  620.       lstSource(mnSourceList).ListIndex = i
  621.     End If
  622.   End If
  623.   lstDestination(mnDestinationList).ListIndex = lstDestination(mnDestinationList).NewIndex
  624.   
  625.   Exit Sub
  626. cmdRightOne_ClickErr:
  627.   MsgBox Err.Description
  628. End Sub
  629.  
  630. Private Sub cmdRightAll_Click()
  631.   On Error GoTo cmdRightAll_ClickErr
  632.   Dim i As Integer
  633.   Dim bCancel As Boolean
  634.   Dim nCount As Integer
  635.   
  636.   nCount = lstSource(mnSourceList).ListCount
  637.   If nCount = 0 Then Exit Sub
  638.   
  639.   'raise the event before doing the move
  640.   RaiseEvent MoveToDestination(bCancel, nCount)
  641.   
  642.   If bCancel Then Exit Sub
  643.   
  644.   'go ahead and move then
  645.   For i = 0 To lstSource(mnSourceList).ListCount - 1
  646.     lstDestination(mnDestinationList).AddItem lstSource(mnSourceList).List(i)
  647.   Next
  648.   lstSource(mnSourceList).Clear
  649.   lstDestination(mnDestinationList).ListIndex = 0
  650.   
  651.   Exit Sub
  652. cmdRightAll_ClickErr:
  653.   MsgBox Err.Description
  654. End Sub
  655.  
  656. Private Sub cmdLeftOne_Click()
  657.   On Error GoTo cmdLeftOne_ClickErr
  658.   Dim i As Integer
  659.   Dim bCancel As Boolean
  660.   
  661.   If lstDestination(mnDestinationList).ListIndex < 0 Then Exit Sub
  662.   i = lstDestination(mnDestinationList).ListIndex
  663.   
  664.   'raise the event before doing the move
  665.   RaiseEvent MoveToSource(bCancel, 1)
  666.   
  667.   If bCancel Then Exit Sub
  668.   
  669.   'go ahead and move it
  670.   lstSource(mnSourceList).AddItem lstDestination(mnDestinationList).Text
  671.   lstDestination(mnDestinationList).RemoveItem lstDestination(mnDestinationList).ListIndex
  672.   
  673.   lstSource(mnSourceList).ListIndex = lstSource(mnSourceList).NewIndex
  674.   If lstDestination(mnDestinationList).ListCount > 0 Then
  675.     If i > lstDestination(mnDestinationList).ListCount - 1 Then
  676.       lstDestination(mnDestinationList).ListIndex = i - 1
  677.     Else
  678.       lstDestination(mnDestinationList).ListIndex = i
  679.     End If
  680.   End If
  681.   
  682.   Exit Sub
  683. cmdLeftOne_ClickErr:
  684.   MsgBox Err.Description
  685. End Sub
  686.  
  687. Private Sub cmdLeftAll_Click()
  688.   On Error GoTo cmdLeftAll_ClickErr
  689.   Dim i As Integer
  690.   Dim bCancel As Boolean
  691.   Dim nCount As Integer
  692.   
  693.   nCount = lstDestination(mnDestinationList).ListCount
  694.   If nCount = 0 Then Exit Sub
  695.   
  696.   'raise the event before doing the move
  697.   RaiseEvent MoveToSource(bCancel, nCount)
  698.   
  699.   If bCancel Then Exit Sub
  700.   
  701.   'go ahead and move then
  702.   For i = 0 To lstDestination(mnDestinationList).ListCount - 1
  703.     lstSource(mnSourceList).AddItem lstDestination(mnDestinationList).List(i)
  704.   Next
  705.   lstDestination(mnDestinationList).Clear
  706.   lstSource(mnSourceList).ListIndex = lstSource(mnSourceList).NewIndex
  707.  
  708.   Exit Sub
  709. cmdLeftAll_ClickErr:
  710.   MsgBox Err.Description
  711. End Sub
  712.  
  713. Private Sub lstSource_DblClick(Index As Integer)
  714.   cmdRightOne_Click
  715. End Sub
  716.  
  717. Private Sub lstDestination_DblClick(Index As Integer)
  718.   cmdLeftOne_Click
  719. End Sub
  720.  
  721. Private Sub UserControl_Initialize()
  722.   mnDestinationSortType = DestinationSortType
  723.   msglWidth = CTL_WIDTH1
  724. End Sub
  725.  
  726. Private Sub UserControl_Resize()
  727.   'force the size
  728.   UserControl.Size msglWidth, 1785
  729. End Sub
  730.  
  731.