Option Strict Off
Option Explicit On

Friend Class ObjectListForm
    Inherits System.Windows.Forms.Form
    Private objs(180) As obj

    Private Sub Cancel_ClickEvent(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Cancel.Click
        Hide()

    End Sub

    'UPGRADE_WARNING: Event ObjectList.Resize may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
    Private Sub ObjectList_Resize(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Resize
#If False Then
        Dim newwidth As Integer
        Dim newheight As Integer
        ObjectList.Width = Me.ClientRectangle.Width - 16
        'ItemList.height = Me.ScaleHeight - 20 - 16
        newheight = Me.ClientRectangle.Height - 46
        newheight = newheight - (newheight Mod 13)
        newheight = newheight + 5
        ObjectList.Height = newheight

        newwidth = ObjectList.Width - 132
        If newwidth < 16 Then
            newwidth = 16
        End If
        newwidth = newwidth * 3 / 4
        'ObjectList.ColumnWidths = "38 pt;" & Str(newwidth) & " pt;49.95 pt"
        Ok.Top = Me.ClientRectangle.Height - 6 - Ok.Height
        Cancel.Top = Me.ClientRectangle.Height - 6 - Cancel.Height
        Cancel.Left = Me.ClientRectangle.Width - 8 - Cancel.Width
#End If
    End Sub
    Private Sub Ok_ClickEvent(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Ok.Click

        Hide()
    End Sub


    'UPGRADE_NOTE: graphics was upgraded to graphics_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Private Sub ObjectList_Renamed_DblClick(ByVal eventSender As System.Object, ByVal eventArgs As EventArgs) Handles ObjectList.DoubleClick
        Dim itemnum As Short
        Dim ItemType As String

        itemnum = ObjectList.FocusedItem.Index + 1
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f556. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        ItemType = graphics.f556.objtype(itemnum)

        Dim dlg_foodeditor As FoodEditor
        Dim dlg_armoreditor As ArmorEditor
        Dim dlg_weaponeditor As WeaponEditor
        Dim dlg_miscobjecteditor As MiscObjectEditor
        If ItemType = "Food" Then
            dlg_foodeditor = New FoodEditor
            dlg_foodeditor.itemnum = itemnum
            dlg_foodeditor.init()
            dlg_foodeditor.parenttype = 3
            dlg_foodeditor.dlg_objectlist = Me
            dlg_foodeditor.Show()
        ElseIf ItemType = "Armor" Then
            dlg_armoreditor = New ArmorEditor
            dlg_armoreditor.itemnum = itemnum
            dlg_armoreditor.init()
            dlg_armoreditor.parenttype = 3
            dlg_armoreditor.dlg_objectlist = Me
            dlg_armoreditor.Show()

        ElseIf ItemType = "Weapon" Then
            dlg_weaponeditor = New WeaponEditor
            dlg_weaponeditor.itemnum = itemnum
            dlg_weaponeditor.init()
            dlg_weaponeditor.parenttype = 3
            dlg_weaponeditor.dlg_objectlist = Me
            dlg_weaponeditor.Show()
        ElseIf ItemType = "Misc" Then
            dlg_miscobjecteditor = New MiscObjectEditor
            dlg_miscobjecteditor.itemnum = itemnum
            dlg_miscobjecteditor.init()
            dlg_miscobjecteditor.parenttype = 3
            dlg_miscobjecteditor.dlg_objectlist = Me
            dlg_miscobjecteditor.Show()
        Else
            MsgBox("Invalid item type")
        End If
    End Sub

    Public Sub init()
        Dim i As Short

        ObjectList.Items.Clear()
        For i = 1 To 180
            ObjectList.Items.Add("1").SubItems.AddRange("2,3".Split(","))
            modifieditem(i)
        Next
    End Sub

    'UPGRADE_NOTE: graphics was upgraded to graphics_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Public Sub modifieditem(ByVal num As Short)
        'UPGRADE_WARNING: Couldn't resolve default property of object ObjectList.List(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        ObjectList.Items(num - 1).Text = zerostr(num - 1, 3)
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f559. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f556. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        'UPGRADE_WARNING: Couldn't resolve default property of object ObjectList.List(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        ObjectList.Items(num - 1).SubItems(1).Text = graphics.f556.objstring(graphics.f559.obj(num).ItemType + 1)
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f556. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        'UPGRADE_WARNING: Couldn't resolve default property of object ObjectList.List(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        ObjectList.Items(num - 1).SubItems(2).Text = graphics.f556.objtype(num)
    End Sub

    Private Sub ObjectListForm_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        If e.CloseReason = CloseReason.UserClosing Then
            e.Cancel = True
            Hide()
        End If
    End Sub
End Class