home *** CD-ROM | disk | FTP | other *** search
/ distrib.akp.su/Programming/Vb-6+Rus/ / distrib.akp.su.tar / distrib.akp.su / Programming / Vb-6+Rus / VB98 / TEMPLATE / CONTROLS / LISTPICK.FRM (.txt) < prev    next >
Visual Basic Form  |  1998-06-18  |  7KB  |  240 lines

  1. VERSION 5.00
  2. Begin VB.Form frmListPickerTemplate 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   1872
  5.    ClientLeft      =   1068
  6.    ClientTop       =   1668
  7.    ClientWidth     =   6420
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   1872
  10.    ScaleWidth      =   6420
  11.    Begin VB.CommandButton cmdDown 
  12.       Height          =   435
  13.       Left            =   5835
  14.       Picture         =   "Mover ListBox.frx":0000
  15.       Style           =   1  'Graphical
  16.       TabIndex        =   7
  17.       Top             =   1110
  18.       Width           =   435
  19.    End
  20.    Begin VB.CommandButton cmdUp 
  21.       Height          =   435
  22.       Left            =   5820
  23.       Picture         =   "Mover ListBox.frx":0102
  24.       Style           =   1  'Graphical
  25.       TabIndex        =   6
  26.       Top             =   525
  27.       Width           =   435
  28.    End
  29.    Begin VB.CommandButton cmdLeftAll 
  30.       Caption         =   "<<"
  31.       BeginProperty Font 
  32.          Name            =   "MS Sans Serif"
  33.          Size            =   9.6
  34.          Charset         =   0
  35.          Weight          =   700
  36.          Underline       =   0   'False
  37.          Italic          =   0   'False
  38.          Strikethrough   =   0   'False
  39.       EndProperty
  40.       Height          =   336
  41.       Left            =   2550
  42.       MaskColor       =   &H00000000&
  43.       TabIndex        =   5
  44.       Top             =   1440
  45.       Width           =   576
  46.    End
  47.    Begin VB.CommandButton cmdLeftOne 
  48.       Caption         =   "<"
  49.       BeginProperty Font 
  50.          Name            =   "MS Sans Serif"
  51.          Size            =   9.6
  52.          Charset         =   0
  53.          Weight          =   700
  54.          Underline       =   0   'False
  55.          Italic          =   0   'False
  56.          Strikethrough   =   0   'False
  57.       EndProperty
  58.       Height          =   336
  59.       Left            =   2550
  60.       MaskColor       =   &H00000000&
  61.       TabIndex        =   4
  62.       Top             =   1065
  63.       Width           =   576
  64.    End
  65.    Begin VB.CommandButton cmdRightAll 
  66.       Caption         =   ">>"
  67.       BeginProperty Font 
  68.          Name            =   "MS Sans Serif"
  69.          Size            =   9.6
  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            =   2550
  78.       MaskColor       =   &H00000000&
  79.       TabIndex        =   3
  80.       Top             =   690
  81.       Width           =   576
  82.    End
  83.    Begin VB.CommandButton cmdRightOne 
  84.       Caption         =   ">"
  85.       BeginProperty Font 
  86.          Name            =   "MS Sans Serif"
  87.          Size            =   9.6
  88.          Charset         =   0
  89.          Weight          =   700
  90.          Underline       =   0   'False
  91.          Italic          =   0   'False
  92.          Strikethrough   =   0   'False
  93.       EndProperty
  94.       Height          =   336
  95.       Left            =   2550
  96.       MaskColor       =   &H00000000&
  97.       TabIndex        =   2
  98.       Top             =   315
  99.       Width           =   576
  100.    End
  101.    Begin VB.ListBox lstSelected 
  102.       Height          =   1392
  103.       Left            =   3435
  104.       TabIndex        =   1
  105.       Top             =   315
  106.       Width           =   2220
  107.    End
  108.    Begin VB.ListBox lstAll 
  109.       Height          =   1392
  110.       Left            =   75
  111.       TabIndex        =   0
  112.       Top             =   315
  113.       Width           =   2220
  114.    End
  115.    Begin VB.Label lblSelected 
  116.       Appearance      =   0  'Flat
  117.       AutoSize        =   -1  'True
  118.       BackColor       =   &H80000005&
  119.       BackStyle       =   0  'Transparent
  120.       Caption         =   "Selected Items:"
  121.       ForeColor       =   &H80000008&
  122.       Height          =   195
  123.       Left            =   3435
  124.       TabIndex        =   9
  125.       Tag             =   "2407"
  126.       Top             =   60
  127.       Width           =   1095
  128.    End
  129.    Begin VB.Label lblAll 
  130.       Appearance      =   0  'Flat
  131.       AutoSize        =   -1  'True
  132.       BackColor       =   &H80000005&
  133.       BackStyle       =   0  'Transparent
  134.       Caption         =   "All Items:"
  135.       ForeColor       =   &H80000008&
  136.       Height          =   195
  137.       Left            =   75
  138.       TabIndex        =   8
  139.       Tag             =   "2406"
  140.       Top             =   60
  141.       Width           =   630
  142.    End
  143. Attribute VB_Name = "frmListPickerTemplate"
  144. Attribute VB_GlobalNameSpace = False
  145. Attribute VB_Creatable = False
  146. Attribute VB_PredeclaredId = True
  147. Attribute VB_Exposed = False
  148. Private Sub cmdUp_Click()
  149.   On Error Resume Next
  150.   Dim nItem As Integer
  151.   With lstSelected
  152.     If .ListIndex < 0 Then Exit Sub
  153.     nItem = .ListIndex
  154.     If nItem = 0 Then Exit Sub  'can't move 1st item up
  155.     'move item up
  156.     .AddItem .Text, nItem - 1
  157.     'remove old item
  158.     .RemoveItem nItem + 1
  159.     'select the item that was just moved
  160.     .Selected(nItem - 1) = True
  161.   End With
  162. End Sub
  163. Private Sub cmdDown_Click()
  164.   On Error Resume Next
  165.   Dim nItem As Integer
  166.   With lstSelected
  167.     If .ListIndex < 0 Then Exit Sub
  168.     nItem = .ListIndex
  169.     If nItem = .ListCount - 1 Then Exit Sub 'can't move last item down
  170.     'move item down
  171.     .AddItem .Text, nItem + 2
  172.     'remove old item
  173.     .RemoveItem nItem
  174.     'select the item that was just moved
  175.     .Selected(nItem + 1) = True
  176.   End With
  177. End Sub
  178. Private Sub cmdRightOne_Click()
  179.   On Error Resume Next
  180.   Dim i As Integer
  181.   If lstAll.ListCount = 0 Then Exit Sub
  182.   lstSelected.AddItem lstAll.Text
  183.   i = lstAll.ListIndex
  184.   lstAll.RemoveItem lstAll.ListIndex
  185.   If lstAll.ListCount > 0 Then
  186.     If i > lstAll.ListCount - 1 Then
  187.       lstAll.ListIndex = i - 1
  188.     Else
  189.       lstAll.ListIndex = i
  190.     End If
  191.   End If
  192.   lstSelected.ListIndex = lstSelected.NewIndex
  193. End Sub
  194. Private Sub cmdRightAll_Click()
  195.   On Error Resume Next
  196.   Dim i As Integer
  197.   For i = 0 To lstAll.ListCount - 1
  198.     lstSelected.AddItem lstAll.List(i)
  199.   Next
  200.   lstAll.Clear
  201.   lstSelected.ListIndex = 0
  202. End Sub
  203. Private Sub cmdLeftOne_Click()
  204.   On Error Resume Next
  205.   Dim i As Integer
  206.   If lstSelected.ListCount = 0 Then Exit Sub
  207.   lstAll.AddItem lstSelected.Text
  208.   i = lstSelected.ListIndex
  209.   lstSelected.RemoveItem i
  210.   lstAll.ListIndex = lstAll.NewIndex
  211.   If lstSelected.ListCount > 0 Then
  212.     If i > lstSelected.ListCount - 1 Then
  213.       lstSelected.ListIndex = i - 1
  214.     Else
  215.       lstSelected.ListIndex = i
  216.     End If
  217.   End If
  218. End Sub
  219. Private Sub cmdLeftAll_Click()
  220.   On Error Resume Next
  221.   Dim i As Integer
  222.   For i = 0 To lstSelected.ListCount - 1
  223.     lstAll.AddItem lstSelected.List(i)
  224.   Next
  225.   lstSelected.Clear
  226.   lstAll.ListIndex = lstAll.NewIndex
  227. End Sub
  228. Private Sub Form_Load()
  229.   lstAll.AddItem "aaa"
  230.   lstAll.AddItem "bbb"
  231.   lstAll.AddItem "ccc"
  232.   lstAll.ListIndex = 0
  233. End Sub
  234. Private Sub lstAll_DblClick()
  235.   cmdRightOne_Click
  236. End Sub
  237. Private Sub lstSelected_DblClick()
  238.   cmdLeftOne_Click
  239. End Sub
  240.