Projects

Find all our projects in development below.
All source code is GNU General Public License (GPL)

QuickQuery Half-Life Edition

Browsing QuickQuery HL Edition/ManageFavoritesForm.frm (5.41 KB)

VERSION 5.00
Begin VB.Form ManageFavoritesForm 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Manage Favorites"
   ClientHeight    =   3870
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   4710
   ClipControls    =   0   'False
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "ManageFavoritesForm.frx":0000
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3870
   ScaleWidth      =   4710
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  'CenterOwner
   Begin VB.CommandButton Command5 
      Cancel          =   -1  'True
      Caption         =   "Cancel"
      Height          =   375
      Left            =   3360
      TabIndex        =   6
      Top             =   3360
      Width           =   1215
   End
   Begin VB.CommandButton Command4 
      Caption         =   "OK"
      Default         =   -1  'True
      Height          =   375
      Left            =   3360
      TabIndex        =   5
      Top             =   2880
      Width           =   1215
   End
   Begin VB.CommandButton Command3 
      Caption         =   "&Remove"
      Enabled         =   0   'False
      Height          =   375
      Left            =   3360
      TabIndex        =   4
      Top             =   1320
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "&Edit..."
      Enabled         =   0   'False
      Height          =   375
      Left            =   3360
      TabIndex        =   3
      Top             =   840
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "&Add..."
      Height          =   375
      Left            =   3360
      TabIndex        =   2
      Top             =   360
      Width           =   1215
   End
   Begin VB.ListBox lstFavorites 
      Height          =   3375
      ItemData        =   "ManageFavoritesForm.frx":000C
      Left            =   120
      List            =   "ManageFavoritesForm.frx":000E
      TabIndex        =   1
      Top             =   360
      Width           =   3135
   End
   Begin VB.Image ImgFavorites 
      Height          =   480
      Left            =   3720
      Picture         =   "ManageFavoritesForm.frx":0010
      Top             =   2040
      Width           =   480
   End
   Begin VB.Label lblFavorites 
      BackStyle       =   0  'Transparent
      Caption         =   "&Favorites:"
      Height          =   255
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   855
   End
End
Attribute VB_Name = "ManageFavoritesForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Dim OldListIndex As Integer
Sub InitList()
Dim i As Integer
    lstFavorites.Clear
    For i = 1 To UBound(FavoritesList)
        lstFavorites.AddItem FavoritesList(i)
    Next i
    If lstFavorites.ListCount > 0 Then
        lstFavorites.ListIndex = 0
        Command2.Enabled = True
        Command3.Enabled = True
    Else
        Command2.Enabled = False
        Command3.Enabled = False
    End If
End Sub


Private Sub Command1_Click()
    AddFavoriteForm.Caption = "Add New Favorite"
    AddFavoriteForm.ListIndex = -1
    AddFavoriteForm.Show 1
    InitList
End Sub

Private Sub Command2_Click()
    With AddFavoriteForm
        .Caption = "Edit Favorite"
        .ListIndex = lstFavorites.ListIndex
        .txtAddress.Text = lstFavorites.List(lstFavorites.ListIndex)
        .txtAddress.SelStart = 0
        .txtAddress.SelLength = Len(.txtAddress.Text)
        .Show 1
    End With
End Sub


Private Sub Command3_Click()
Dim i As Integer
    i = lstFavorites.ListIndex
    lstFavorites.RemoveItem i
    lstFavorites.ListIndex = i - 1
    If lstFavorites.ListCount > 0 Then
        lstFavorites.ListIndex = 0
        Command2.Enabled = True
        Command3.Enabled = True
    Else
        Command2.Enabled = False
        Command3.Enabled = False
    End If
End Sub


Private Sub Command4_Click()
Dim i As Integer
    ReDim FavoritesList(lstFavorites.ListCount)
    For i = 0 To lstFavorites.ListCount - 1
        FavoritesList(i + 1) = lstFavorites.List(i)
    Next i
    Unload Me
End Sub

Private Sub Command5_Click()
    Unload Me
End Sub


Private Sub Form_Load()
    InitList
End Sub


Private Sub lstFavorites_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    OldListIndex = lstFavorites.ListIndex
End Sub


Private Sub lstFavorites_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Or (Button = vbRightButton And IsMouseSwapped()) Then
    If lstFavorites.ListIndex <> OldListIndex Then
        Dim ListString As String
        ListString = lstFavorites.List(lstFavorites.ListIndex)
        lstFavorites.List(lstFavorites.ListIndex) = lstFavorites.List(OldListIndex)
        lstFavorites.List(OldListIndex) = ListString
        OldListIndex = lstFavorites.ListIndex
    End If
End If
End Sub


Download QuickQuery HL Edition/ManageFavoritesForm.frm

Back to file list


Back to project page