VERSION 5.00
Object = "{396D2EB4-53AA-11D1-A1D9-4676EE000000}#1.0#0"; "envelope.ocx"
Begin VB.Form frmCustom1 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "#window#"
   ClientHeight    =   3195
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4680
   Icon            =   "frmCustom1.frx":0000
   LinkTopic       =   "Form1"
   MinButton       =   0   'False
   ScaleHeight     =   213
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   312
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin ENVELOPELib.Envelope Envelope1 
      Height          =   495
      Index           =   0
      Left            =   1560
      TabIndex        =   6
      Top             =   1080
      Visible         =   0   'False
      Width           =   1215
      _Version        =   65536
      _ExtentX        =   2143
      _ExtentY        =   873
      _StockProps     =   0
   End
   Begin VB.ListBox lstCustom1 
      Height          =   375
      Index           =   0
      IntegralHeight  =   0   'False
      Left            =   1560
      TabIndex        =   5
      Top             =   600
      Visible         =   0   'False
      Width           =   1215
   End
   Begin VB.TextBox txtCustom3 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Index           =   0
      Left            =   120
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   2280
      Visible         =   0   'False
      Width           =   1215
   End
   Begin VB.TextBox txtCustom2 
      Height          =   1095
      Index           =   0
      Left            =   120
      MultiLine       =   -1  'True
      ScrollBars      =   3  'Both
      TabIndex        =   2
      Top             =   1080
      Visible         =   0   'False
      Width           =   1215
   End
   Begin VB.TextBox txtCustom1 
      Height          =   375
      Index           =   0
      Left            =   120
      TabIndex        =   1
      Text            =   "##"
      Top             =   600
      Visible         =   0   'False
      Width           =   1215
   End
   Begin VB.CommandButton cmdCustom1 
      Caption         =   "#button#"
      Height          =   375
      Index           =   0
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Visible         =   0   'False
      Width           =   1335
   End
   Begin VB.Image imgCustom1 
      Height          =   255
      Index           =   0
      Left            =   1560
      Top             =   120
      Visible         =   0   'False
      Width           =   1215
   End
   Begin VB.Label lblCustom1 
      BackStyle       =   0  'Transparent
      Caption         =   "#label#"
      Height          =   375
      Index           =   0
      Left            =   240
      TabIndex        =   4
      Top             =   2880
      Visible         =   0   'False
      Width           =   1095
   End
End
Attribute VB_Name = "frmCustom1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit

Public MyHandle As String

Private Command_Newindex As Integer
Private Command_Label(20) As String
Private Label_Newindex As Integer
Private Label_Label(20) As String
Private Image_Newindex As Integer
Private Image_Label(20) As String
Private Text1_Newindex As Integer
Private Text1_Label(20) As String
Private Text2_Newindex As Integer
Private Text2_Label(20) As String
Private Text3_Newindex As Integer
Private Text3_Label(20) As String
Private List_Newindex As Integer
Private List_Label(20) As String
Private Envelope_Newindex As Integer
Private Envelope_Label(20) As String



Public Sub AddEnvelope(ByVal CtlHandle As String, ByVal Caption As String, ByVal GotoLabel As String, ByVal PX As Integer, ByVal PY As Integer, ByVal PWidth As Integer, ByVal PHeight As Integer)
    On Error Resume Next
    dbug "runtime", "Making Env"
    Load Envelope1(Envelope_Newindex)
    Envelope1(Envelope_Newindex).Tag = CtlHandle
    Envelope1(Envelope_Newindex).Caption = Caption
    Envelope_Label(Envelope_Newindex) = GotoLabel
    dbug "runtime", "setting vals"
    If (PX <> -1) Then Envelope1(Envelope_Newindex).Left = PX
    If (PY <> -1) Then Envelope1(Envelope_Newindex).Top = PY
    If (PWidth <> -1) Then Envelope1(Envelope_Newindex).Width = PWidth
    If (PHeight <> -1) Then Envelope1(Envelope_Newindex).Height = PHeight
    Envelope1(Envelope_Newindex).Visible = True
    dbug "runtime", "visible"
    Envelope_Newindex = Envelope_Newindex + 1
    On Error GoTo 0
End Sub

Public Sub AddButton(ByVal CtlHandle As String, ByVal Caption As String, ByVal GotoLabel As String, ByVal PX As Integer, ByVal PY As Integer, ByVal PWidth As Integer, ByVal PHeight As Integer)
    On Error Resume Next
    Load cmdCustom1(Command_Newindex)
    cmdCustom1(Command_Newindex).Tag = CtlHandle
    cmdCustom1(Command_Newindex).Caption = Caption
    Command_Label(Command_Newindex) = GotoLabel
    If (PX <> -1) Then cmdCustom1(Command_Newindex).Left = PX
    If (PY <> -1) Then cmdCustom1(Command_Newindex).Top = PY
    If (PWidth <> -1) Then cmdCustom1(Command_Newindex).Width = PWidth
    If (PHeight <> -1) Then cmdCustom1(Command_Newindex).Height = PHeight
    cmdCustom1(Command_Newindex).Visible = True
    Command_Newindex = Command_Newindex + 1
    On Error GoTo 0
End Sub

Public Sub AddLabel(ByVal CtlHandle As String, ByVal Caption As String, ByVal GotoLabel As String, ByVal PX As Integer, ByVal PY As Integer, ByVal PWidth As Integer, ByVal PHeight As Integer)
    On Error Resume Next
    Load lblCustom1(Label_Newindex)
    lblCustom1(Label_Newindex).Tag = CtlHandle
    lblCustom1(Label_Newindex).Caption = Caption
    Label_Label(Label_Newindex) = GotoLabel
    If (PX <> -1) Then lblCustom1(Label_Newindex).Left = PX
    If (PY <> -1) Then lblCustom1(Label_Newindex).Top = PY
    If (PWidth <> -1) Then lblCustom1(Label_Newindex).Width = PWidth
    If (PHeight <> -1) Then lblCustom1(Label_Newindex).Height = PHeight
    lblCustom1(Label_Newindex).Visible = True
    Label_Newindex = Label_Newindex + 1
    On Error GoTo 0
End Sub

Public Sub AddTextField(ByVal CtlHandle As String, ByVal Caption As String, ByVal GotoLabel As String, ByVal PX As Integer, ByVal PY As Integer, ByVal PWidth As Integer, ByVal PHeight As Integer)
    On Error Resume Next
    Load txtCustom1(Text1_Newindex)
    txtCustom1(Text1_Newindex).Tag = CtlHandle
    txtCustom1(Text1_Newindex).text = Caption
    Text1_Label(Text1_Newindex) = GotoLabel
    If (PX <> -1) Then txtCustom1(Text1_Newindex).Left = PX
    If (PY <> -1) Then txtCustom1(Text1_Newindex).Top = PY
    If (PWidth <> -1) Then txtCustom1(Text1_Newindex).Width = PWidth
    If (PHeight <> -1) Then txtCustom1(Text1_Newindex).Height = PHeight
    txtCustom1(Text1_Newindex).Visible = True
    Text1_Newindex = Text1_Newindex + 1
    On Error GoTo 0
End Sub

Public Sub AddTextArea(ByVal CtlHandle As String, ByVal Caption As String, ByVal GotoLabel As String, ByVal PX As Integer, ByVal PY As Integer, ByVal PWidth As Integer, ByVal PHeight As Integer)
    On Error Resume Next
    Load txtCustom2(Text2_Newindex)
    txtCustom2(Text2_Newindex).Tag = CtlHandle
    txtCustom2(Text2_Newindex).text = Caption
    Text2_Label(Text2_Newindex) = GotoLabel
    If (PX <> -1) Then txtCustom2(Text2_Newindex).Left = PX
    If (PY <> -1) Then txtCustom2(Text2_Newindex).Top = PY
    If (PWidth <> -1) Then txtCustom2(Text2_Newindex).Width = PWidth
    If (PHeight <> -1) Then txtCustom2(Text2_Newindex).Height = PHeight
    txtCustom2(Text2_Newindex).Visible = True
    Text2_Newindex = Text2_Newindex + 1
    On Error GoTo 0
End Sub
Public Sub AddRichTextArea(ByVal CtlHandle As String, ByVal Caption As String, ByVal GotoLabel As String, ByVal PX As Integer, ByVal PY As Integer, ByVal PWidth As Integer, ByVal PHeight As Integer)
    On Error Resume Next
    Load txtCustom2(Text2_Newindex)
    txtCustom2(Text2_Newindex).Tag = CtlHandle
    txtCustom2(Text2_Newindex).text = Caption
    Text2_Label(Text2_Newindex) = GotoLabel
    If (PX <> -1) Then txtCustom2(Text2_Newindex).Left = PX
    If (PY <> -1) Then txtCustom2(Text2_Newindex).Top = PY
    If (PWidth <> -1) Then txtCustom2(Text2_Newindex).Width = PWidth
    If (PHeight <> -1) Then txtCustom2(Text2_Newindex).Height = PHeight
    txtCustom2(Text2_Newindex).Visible = True
    Text2_Newindex = Text2_Newindex + 1
    On Error GoTo 0
End Sub


Public Sub AddTextPassword(ByVal CtlHandle As String, ByVal Caption As String, ByVal GotoLabel As String, ByVal PX As Integer, ByVal PY As Integer, ByVal PWidth As Integer, ByVal PHeight As Integer)
    On Error Resume Next
    Load txtCustom3(Text3_Newindex)
    txtCustom3(Text3_Newindex).Tag = CtlHandle
    txtCustom3(Text3_Newindex).text = Caption
    Text3_Label(Text3_Newindex) = GotoLabel
    If (PX <> -1) Then txtCustom3(Text3_Newindex).Left = PX
    If (PY <> -1) Then txtCustom3(Text3_Newindex).Top = PY
    If (PWidth <> -1) Then txtCustom3(Text3_Newindex).Width = PWidth
    If (PHeight <> -1) Then txtCustom3(Text3_Newindex).Height = PHeight
    txtCustom3(Text3_Newindex).Visible = True
    Text3_Newindex = Text3_Newindex + 1
    On Error GoTo 0
End Sub

Public Sub AddImage(ByVal CtlHandle As String, ByVal ImageStr As String, ByVal GotoLabel As String, ByVal PX As Integer, ByVal PY As Integer, ByVal PWidth As Integer, ByVal PHeight As Integer)
    On Error Resume Next
    Load imgCustom1(Image_Newindex)
    imgCustom1(Image_Newindex).Tag = CtlHandle
    If (Trim$(ImageStr) <> "") Then
        Set imgCustom1(Image_Newindex).Picture = LoadPicture(cd$ & "\" & Trim$(ImageStr))
    End If
    Image_Label(Image_Newindex) = GotoLabel
    If (PX <> -1) Then imgCustom1(Image_Newindex).Left = PX
    If (PY <> -1) Then imgCustom1(Image_Newindex).Top = PY
    If (PWidth <> -1) Then imgCustom1(Image_Newindex).Width = PWidth
    If (PHeight <> -1) Then imgCustom1(Image_Newindex).Height = PHeight
    imgCustom1(Image_Newindex).Visible = True
    Image_Newindex = Image_Newindex + 1
    On Error GoTo 0
End Sub

Public Sub AddList(ByVal CtlHandle As String, ByVal GotoLabel As String, ByVal PX As Integer, ByVal PY As Integer, ByVal PWidth As Integer, ByVal PHeight As Integer)
    On Error Resume Next
    Load lstCustom1(List_Newindex)
    lstCustom1(List_Newindex).Tag = CtlHandle
    List_Label(List_Newindex) = GotoLabel
    If (PX <> -1) Then lstCustom1(List_Newindex).Left = PX
    If (PY <> -1) Then lstCustom1(List_Newindex).Top = PY
    If (PWidth <> -1) Then lstCustom1(List_Newindex).Width = PWidth
    If (PHeight <> -1) Then lstCustom1(List_Newindex).Height = PHeight
    lstCustom1(List_Newindex).Visible = True
    List_Newindex = List_Newindex + 1
    On Error GoTo 0
End Sub


Public Sub SetTextFieldValue(ByVal handle As String, ByVal text As String)
    Dim cntrl As TextBox
    On Error Resume Next
    For Each cntrl In txtCustom1
        If cntrl.Tag = handle Then
            cntrl.text = text
        End If
    Next
    On Error GoTo 0
End Sub

Public Sub SetTextAreaValue(ByVal handle As String, ByVal text As String)
    Dim cntrl As TextBox
    On Error Resume Next
    For Each cntrl In txtCustom2
        If cntrl.Tag = handle Then
            cntrl.text = text
        End If
    Next
    On Error GoTo 0
End Sub

Public Sub SetTextPasswordValue(ByVal handle As String, ByVal text As String)
    Dim cntrl As TextBox
    On Error Resume Next
    For Each cntrl In txtCustom3
        If cntrl.Tag = handle Then
            cntrl.text = text
        End If
    Next
    On Error GoTo 0
End Sub


Public Function GetTextFieldValue(ByVal handle As String) As String
    Dim cntrl As TextBox
    On Error Resume Next
    For Each cntrl In txtCustom1
        If cntrl.Tag = handle Then
            GetTextFieldValue = cntrl.text
            Exit Function
        End If
    Next
    GetTextFieldValue = ""
    Exit Function
    On Error GoTo 0
End Function

Public Function GetTextAreaValue(ByVal handle As String) As String
    Dim cntrl As TextBox
    On Error Resume Next
    For Each cntrl In txtCustom2
        If cntrl.Tag = handle Then
            GetTextAreaValue = cntrl.text
            Exit Function
        End If
    Next
    GetTextAreaValue = ""
    Exit Function
    On Error GoTo 0
End Function

Public Function GetTextPasswordValue(ByVal handle As String) As String
    Dim cntrl As TextBox
    On Error Resume Next
    For Each cntrl In txtCustom3
        If cntrl.Tag = handle Then
            GetTextPasswordValue = cntrl.text
            Exit Function
        End If
    Next
    GetTextPasswordValue = ""
    Exit Function
    On Error GoTo 0
End Function


Public Function GetListString(ByVal handle As String) As String
    Dim cntrl As ListBox
    On Error Resume Next
    For Each cntrl In lstCustom1
        If cntrl.Tag = handle Then
            GetListString = cntrl.List(cntrl.ListIndex)
            Exit Function
        End If
    Next
    GetListString = ""
    Exit Function
    On Error GoTo 0
End Function

Public Sub AddListString(ByVal handle As String, ByVal text As String)
    Dim cntrl As ListBox
    On Error Resume Next
    For Each cntrl In lstCustom1
        If cntrl.Tag = handle Then
            cntrl.AddItem text
        End If
    Next
    On Error GoTo 0
End Sub

Public Sub RemoveListString(ByVal handle As String, ByVal text As String)
    Dim cntrl As ListBox
    Dim ix As Integer
    On Error Resume Next
    For Each cntrl In lstCustom1
        If cntrl.Tag = handle Then
            For ix = 0 To cntrl.ListCount
                If (cntrl.List(ix) = text) Then
                    cntrl.RemoveItem ix
                    Exit Sub
                End If
            Next ix
        End If
    Next
    On Error GoTo 0
End Sub

Public Sub ClearList(ByVal handle As String)
    Dim cntrl As ListBox
    On Error Resume Next
    For Each cntrl In lstCustom1
        If cntrl.Tag = handle Then
            cntrl.Clear
        End If
    Next
    On Error GoTo 0
End Sub


Private Sub cmdCustom1_Click(Index As Integer)
    On Error Resume Next
    If (Len(Command_Label(Index)) <> 0) Then
        WinIdle = False
        pointer = Val(variable(Command_Label(Index)))
    End If
    On Error GoTo 0
End Sub

Private Sub Form_Load()
    On Error Resume Next
    Command_Newindex = 1
    Label_Newindex = 1
    Image_Newindex = 1
    Text1_Newindex = 1
    Text2_Newindex = 1
    Text3_Newindex = 1
    List_Newindex = 1
    On Error GoTo 0
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    On Error Resume Next
    GUIForms.Remove MyHandle
    If (GUIForms.Count = 0) Then
        ' the only thing atm
        End
    End If
    On Error GoTo 0
End Sub

Private Sub imgCustom1_Click(Index As Integer)
    On Error Resume Next
    If (Len(Image_Label(Index)) <> 0) Then
        WinIdle = False
        pointer = Val(variable(Image_Label(Index)))
    End If
    On Error GoTo 0
End Sub

Private Sub lblCustom1_Click(Index As Integer)
    On Error Resume Next
    If (Len(Label_Label(Index)) <> 0) Then
        WinIdle = False
        pointer = Val(variable(Label_Label(Index)))
    End If
    On Error GoTo 0
End Sub

Private Sub lstCustom1_Click(Index As Integer)
    On Error Resume Next
    If (Len(List_Label(Index)) <> 0) Then
        WinIdle = False
        pointer = Val(variable(List_Label(Index)))
    End If
    On Error GoTo 0
End Sub

Private Sub RichTextBox1_Change(Index As Integer)

End Sub

Private Sub txtCustom1_Change(Index As Integer)
    On Error Resume Next
    If (Len(Text1_Label(Index)) <> 0) Then
        WinIdle = False
        pointer = Val(variable(Text1_Label(Index)))
    End If
    On Error GoTo 0
End Sub

Private Sub txtCustom2_Change(Index As Integer)
    On Error Resume Next
    If (Len(Text2_Label(Index)) <> 0) Then
        WinIdle = False
        pointer = Val(variable(Text2_Label(Index)))
    End If
    On Error GoTo 0
End Sub

Private Sub txtCustom3_Change(Index As Integer)
    On Error Resume Next
    If (Len(Text3_Label(Index)) <> 0) Then
        WinIdle = False
        pointer = Val(variable(Text3_Label(Index)))
    End If
    On Error GoTo 0
End Sub
