home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 March / VPR9703A.ISO / MS_DEV / VBCCE / vb5ccein.exe / RCDATA / CABINET / AXLstPik.ctl < prev    next >
Text File  |  1996-10-25  |  22KB  |  733 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 = "ActiveX List Picker 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.   On Error Resume Next
  387.   'Load property values from storage
  388.   mbReadingProperties = True
  389.   SourceCaption = PropBag.ReadProperty("SourceCaption")
  390.   DestinationCaption = PropBag.ReadProperty("DestinationCaption")
  391.   SourceSortType = PropBag.ReadProperty("SourceSortType", mnSourceSortType)
  392.   DestinationSortType = PropBag.ReadProperty("DestinationSortType", mnDestinationSortType)
  393.   BackColor = PropBag.ReadProperty("BackColor", &H8000000F)
  394.   ListColor = PropBag.ReadProperty("ListColor", &H80000005)
  395.   Set ListBoxFont = PropBag.ReadProperty("ListBoxFont")
  396.   Set LabelFont = PropBag.ReadProperty("LabelFont")
  397.   Enabled = PropBag.ReadProperty("Enabled", True)
  398. '   = PropBag.ReadProperty("", )
  399.   mbReadingProperties = False
  400. End Sub
  401.  
  402. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  403.   On Error Resume Next
  404.   'Write property values to storage
  405.   Call PropBag.WriteProperty("SourceCaption", SourceCaption, "")
  406.   Call PropBag.WriteProperty("DestinationCaption", DestinationCaption, "")
  407.   Call PropBag.WriteProperty("SourceSortType", SourceSortType, 0)
  408.   Call PropBag.WriteProperty("DestinationSortType", DestinationSortType, 0)
  409.   Call PropBag.WriteProperty("BackColor", BackColor, &H8000000F)
  410.   Call PropBag.WriteProperty("ListColor", ListColor, &H80000005)
  411.   Call PropBag.WriteProperty("ListBoxFont", ListBoxFont)
  412.   Call PropBag.WriteProperty("LabelFont", LabelFont)
  413.   Call PropBag.WriteProperty("Enabled", Enabled, True)
  414. '  Call PropBag.WriteProperty("", , )
  415. End Sub
  416.  
  417. '================================================================
  418. ' Runtime Only Public Properties
  419. '================================================================
  420. Public Property Let SourceListIndex(nIndex As Integer)
  421. Attribute SourceListIndex.VB_MemberFlags = "400"
  422.   On Error Resume Next
  423.   lstSource(mnSourceList).ListIndex = nIndex
  424.   If Err Then
  425.     MsgBox Error(9)
  426.   End If
  427. End Property
  428.  
  429. Public Property Get SourceListIndex() As Integer
  430.   SourceListIndex = lstSource(mnSourceList).ListIndex
  431. End Property
  432.  
  433. Public Property Let DestinationListIndex(nIndex As Integer)
  434. Attribute DestinationListIndex.VB_MemberFlags = "400"
  435.   On Error Resume Next
  436.   lstDestination(mnDestinationList).ListIndex = nIndex
  437.   If Err Then
  438.     MsgBox Error(9)
  439.   End If
  440. End Property
  441.  
  442. Public Property Get DestinationListTopIndex() As Integer
  443. Attribute DestinationListTopIndex.VB_MemberFlags = "400"
  444.   DestinationListTopIndex = lstDestination(mnDestinationList).TopIndex
  445. End Property
  446.  
  447. Public Property Let SourceListTopIndex(nTopIndex As Integer)
  448. Attribute SourceListTopIndex.VB_MemberFlags = "400"
  449.   On Error Resume Next
  450.   lstSource(mnSourceList).TopIndex = nTopIndex
  451.   If Err Then
  452.     MsgBox Error(9)
  453.   End If
  454. End Property
  455.  
  456. Public Property Get SourceListTopIndex() As Integer
  457.   SourceListTopIndex = lstSource(mnSourceList).TopIndex
  458. End Property
  459.  
  460. Public Property Let DestinationListTopIndex(nTopIndex As Integer)
  461.   On Error Resume Next
  462.   lstDestination(mnDestinationList).ListIndex = nTopIndex
  463.   If Err Then
  464.     MsgBox Error(9)
  465.   End If
  466. End Property
  467.  
  468. Public Property Get DestinationListIndex() As Integer
  469.   DestinationListIndex = lstDestination(mnDestinationList).ListIndex
  470. End Property
  471.  
  472. Public Property Get SourceList(nIndex As Integer) As String
  473. Attribute SourceList.VB_MemberFlags = "400"
  474.   On Error GoTo SourceListErr
  475.   SourceList = lstSource(mnSourceList).List(nIndex)
  476.   Exit Property
  477. SourceListErr:
  478.   MsgBox Error
  479. End Property
  480.  
  481. Public Property Get DestinationList(nIndex As Integer) As String
  482. Attribute DestinationList.VB_MemberFlags = "400"
  483.   On Error GoTo DestinationListErr
  484.   DestinationList = lstDestination(mnDestinationList).List(nIndex)
  485.   Exit Property
  486. DestinationListErr:
  487.   MsgBox Error
  488. End Property
  489.  
  490. Public Property Get ListCount(nList As lspListCountConstants) As Long
  491. Attribute ListCount.VB_MemberFlags = "400"
  492.   If nList = lspSource Then
  493.     ListCount = lstSource(mnSourceList).ListCount
  494.   ElseIf nList = lspDesintation Then
  495.     ListCount = lstDestination(mnDestinationList).ListCount
  496.   ElseIf nList = lspAll Then
  497.     ListCount = lstSource(mnSourceList).ListCount + lstDestination(mnDestinationList).ListCount
  498.   Else
  499.     MsgBox Error(380)
  500.   End If
  501. End Property
  502.  
  503. '================================================================
  504. ' Public methods
  505. '================================================================
  506. Public Sub AddItem(sItem As String, lCtrl As lspListIndex, Optional nIndex As Variant)
  507.   On Error GoTo AddSourceItemErr
  508.  
  509.   If lCtrl = lspSourceList Then
  510.     If TypeName(nIndex) = "Integer" Then
  511.       lstSource(mnSourceList).AddItem sItem, nIndex
  512.     Else
  513.       lstSource(mnSourceList).AddItem sItem
  514.     End If
  515.   '  If lstSource(mnSourceList).ListIndex < 0 And lstSource(mnSourceList).ListCount > 0 Then
  516.       'select the first item added
  517.       lstSource(mnSourceList).ListIndex = 0
  518.   '  End If
  519.   ElseIf lCtrl = lspDestinationList Then
  520.     If TypeName(nIndex) = "Integer" Then
  521.       lstDestination(mnDestinationList).AddItem sItem, nIndex
  522.     Else
  523.       lstDestination(mnDestinationList).AddItem sItem
  524.     End If
  525.   Else
  526.     MsgBox Error(5)
  527.   End If
  528.  
  529.   Exit Sub
  530.   
  531. AddSourceItemErr:
  532.   MsgBox Error
  533. End Sub
  534.  
  535. Public Sub RemoveItem(lCtrl As lspListIndex, nIndex As Integer)
  536.   On Error GoTo RemoveSourceItemErr
  537.  
  538.   If lCtrl = lspSourceList Then
  539.     lstSource(mnSourceList).RemoveItem nIndex
  540.   ElseIf lCtrl = lspDestinationList Then
  541.     lstDestination(mnDestinationList).RemoveItem nIndex
  542.   Else
  543.     MsgBox Error(5)
  544.   End If
  545.  
  546.   Exit Sub
  547.   
  548. RemoveSourceItemErr:
  549.   MsgBox Error
  550. End Sub
  551.  
  552. Public Sub ClearSource()
  553.   lstSource(mnSourceList).Clear
  554. End Sub
  555.  
  556. Public Sub ClearDestination()
  557.   lstDestination(mnDestinationList).Clear
  558. End Sub
  559.  
  560. Public Sub ClearAll()
  561.   lstSource(mnSourceList).Clear
  562.   lstDestination(mnDestinationList).Clear
  563. End Sub
  564.  
  565. '================================================================
  566. ' Private events and support routines
  567. '================================================================
  568. Private Sub cmdUp_Click()
  569.   On Error Resume Next
  570.   Dim nItem As Integer
  571.   
  572.   With lstDestination(mnDestinationList)
  573.     If .ListIndex < 0 Then Exit Sub
  574.     nItem = .ListIndex
  575.     If nItem = 0 Then Exit Sub  'can't move 1st item up
  576.     'move item up
  577.     .AddItem .Text, nItem - 1
  578.     'remove old item
  579.     .RemoveItem nItem + 1
  580.     'select the item that was just moved
  581.     .Selected(nItem - 1) = True
  582.   End With
  583. End Sub
  584.  
  585. Private Sub cmdDown_Click()
  586.   On Error Resume Next
  587.   Dim nItem As Integer
  588.   
  589.   With lstDestination(mnDestinationList)
  590.     If .ListIndex < 0 Then Exit Sub
  591.     nItem = .ListIndex
  592.     If nItem = .ListCount - 1 Then Exit Sub 'can't move last item down
  593.     'move item down
  594.     .AddItem .Text, nItem + 2
  595.     'remove old item
  596.     .RemoveItem nItem
  597.     'select the item that was just moved
  598.     .Selected(nItem + 1) = True
  599.   End With
  600. End Sub
  601.  
  602. Private Sub cmdRightOne_Click()
  603.   On Error GoTo cmdRightOne_ClickErr
  604.   Dim i As Integer
  605.   Dim bCancel As Boolean
  606.   
  607.   If lstSource(mnSourceList).ListIndex < 0 Then Exit Sub
  608.   i = lstSource(mnSourceList).ListIndex
  609.   
  610.   'raise the event before doing the move
  611.   RaiseEvent MoveToDestination(bCancel, 1)
  612.   
  613.   If bCancel Then Exit Sub
  614.   
  615.   'go ahead and move it
  616.   lstDestination(mnDestinationList).AddItem lstSource(mnSourceList).Text
  617.   lstSource(mnSourceList).RemoveItem lstSource(mnSourceList).ListIndex
  618.   If lstSource(mnSourceList).ListCount > 0 Then
  619.     If i > lstSource(mnSourceList).ListCount - 1 Then
  620.       lstSource(mnSourceList).ListIndex = i - 1
  621.     Else
  622.       lstSource(mnSourceList).ListIndex = i
  623.     End If
  624.   End If
  625.   lstDestination(mnDestinationList).ListIndex = lstDestination(mnDestinationList).NewIndex
  626.   
  627.   Exit Sub
  628. cmdRightOne_ClickErr:
  629.   MsgBox Err.Description
  630. End Sub
  631.  
  632. Private Sub cmdRightAll_Click()
  633.   On Error GoTo cmdRightAll_ClickErr
  634.   Dim i As Integer
  635.   Dim bCancel As Boolean
  636.   Dim nCount As Integer
  637.   
  638.   nCount = lstSource(mnSourceList).ListCount
  639.   If nCount = 0 Then Exit Sub
  640.   
  641.   'raise the event before doing the move
  642.   RaiseEvent MoveToDestination(bCancel, nCount)
  643.   
  644.   If bCancel Then Exit Sub
  645.   
  646.   'go ahead and move then
  647.   For i = 0 To lstSource(mnSourceList).ListCount - 1
  648.     lstDestination(mnDestinationList).AddItem lstSource(mnSourceList).List(i)
  649.   Next
  650.   lstSource(mnSourceList).Clear
  651.   lstDestination(mnDestinationList).ListIndex = 0
  652.   
  653.   Exit Sub
  654. cmdRightAll_ClickErr:
  655.   MsgBox Err.Description
  656. End Sub
  657.  
  658. Private Sub cmdLeftOne_Click()
  659.   On Error GoTo cmdLeftOne_ClickErr
  660.   Dim i As Integer
  661.   Dim bCancel As Boolean
  662.   
  663.   If lstDestination(mnDestinationList).ListIndex < 0 Then Exit Sub
  664.   i = lstDestination(mnDestinationList).ListIndex
  665.   
  666.   'raise the event before doing the move
  667.   RaiseEvent MoveToSource(bCancel, 1)
  668.   
  669.   If bCancel Then Exit Sub
  670.   
  671.   'go ahead and move it
  672.   lstSource(mnSourceList).AddItem lstDestination(mnDestinationList).Text
  673.   lstDestination(mnDestinationList).RemoveItem lstDestination(mnDestinationList).ListIndex
  674.   
  675.   lstSource(mnSourceList).ListIndex = lstSource(mnSourceList).NewIndex
  676.   If lstDestination(mnDestinationList).ListCount > 0 Then
  677.     If i > lstDestination(mnDestinationList).ListCount - 1 Then
  678.       lstDestination(mnDestinationList).ListIndex = i - 1
  679.     Else
  680.       lstDestination(mnDestinationList).ListIndex = i
  681.     End If
  682.   End If
  683.   
  684.   Exit Sub
  685. cmdLeftOne_ClickErr:
  686.   MsgBox Err.Description
  687. End Sub
  688.  
  689. Private Sub cmdLeftAll_Click()
  690.   On Error GoTo cmdLeftAll_ClickErr
  691.   Dim i As Integer
  692.   Dim bCancel As Boolean
  693.   Dim nCount As Integer
  694.   
  695.   nCount = lstDestination(mnDestinationList).ListCount
  696.   If nCount = 0 Then Exit Sub
  697.   
  698.   'raise the event before doing the move
  699.   RaiseEvent MoveToSource(bCancel, nCount)
  700.   
  701.   If bCancel Then Exit Sub
  702.   
  703.   'go ahead and move then
  704.   For i = 0 To lstDestination(mnDestinationList).ListCount - 1
  705.     lstSource(mnSourceList).AddItem lstDestination(mnDestinationList).List(i)
  706.   Next
  707.   lstDestination(mnDestinationList).Clear
  708.   lstSource(mnSourceList).ListIndex = lstSource(mnSourceList).NewIndex
  709.  
  710.   Exit Sub
  711. cmdLeftAll_ClickErr:
  712.   MsgBox Err.Description
  713. End Sub
  714.  
  715. Private Sub lstSource_DblClick(Index As Integer)
  716.   cmdRightOne_Click
  717. End Sub
  718.  
  719. Private Sub lstDestination_DblClick(Index As Integer)
  720.   cmdLeftOne_Click
  721. End Sub
  722.  
  723. Private Sub UserControl_Initialize()
  724.   mnDestinationSortType = DestinationSortType
  725.   msglWidth = CTL_WIDTH1
  726. End Sub
  727.  
  728. Private Sub UserControl_Resize()
  729.   'force the size
  730.   UserControl.Size msglWidth, 1785
  731. End Sub
  732.  
  733.