VERSION 5.00 Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX" Begin VB.Form frmConstants BorderStyle = 3 'Fixed Dialog Caption = " Edit Constants" ClientHeight = 3975 ClientLeft = 45 ClientTop = 330 ClientWidth = 9165 Icon = "frmConstants.frx":0000 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 3975 ScaleWidth = 9165 ShowInTaskbar = 0 'False StartUpPosition = 1 'CenterOwner Begin VB.ComboBox lbConstants BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00FF0000& Height = 315 ItemData = "frmConstants.frx":08CA Left = 135 List = "frmConstants.frx":08CC TabIndex = 6 Top = 270 Width = 3165 End Begin RichTextLib.RichTextBox txtValue Height = 2790 Left = 120 TabIndex = 5 Top = 690 Width = 8910 _ExtentX = 15716 _ExtentY = 4921 _Version = 393217 Enabled = 0 'False ScrollBars = 2 DisableNoScroll = -1 'True TextRTF = $"frmConstants.frx":08CE BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Courier New" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty End Begin VB.CommandButton cbOkay Caption = "&OK" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 7560 TabIndex = 3 Top = 3540 Width = 1470 End Begin VB.CommandButton cbNew Caption = "&Add" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 3600 TabIndex = 2 Top = 240 Width = 1470 End Begin VB.CommandButton cbRename Caption = "&Rename" Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 5580 TabIndex = 1 Top = 240 Width = 1470 End Begin VB.CommandButton cbDelete Caption = "&Delete" Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 7560 TabIndex = 0 Top = 240 Width = 1470 End Begin VB.Label lblDebug Caption = "Debug is an on/off constant - no value is needed." BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 270 Left = 150 TabIndex = 7 Top = 780 Visible = 0 'False Width = 5040 End Begin VB.Label Label3 Caption = "Constants" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 195 Left = 150 TabIndex = 4 Top = 60 Width = 1125 End End Attribute VB_Name = "frmConstants" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Form_Load() Dim cons As infNameValueDef lbConstants.Clear For Each cons In inf.Modules("Main").Constants lbConstants.AddItem cons.Name Next End Sub Private Sub cbDelete_Click() Dim upCount As Long Dim cont As String cont = MsgBox("Do you wish to delete the constant '" & lbConstants.Text & "'?", vbYesNoCancel, "Delete Constant") If cont = vbYes Then inf.Modules("Main").Constants.Remove lbConstants.Text If LCase(lbConstants.Text) = "debug" Then lblDebug.Visible = False txtValue.Visible = True txtValue.Enabled = False End If lbConstants.RemoveItem lbConstants.ListIndex End If End Sub Private Sub cbNew_Click() Dim newcons As String newcons = InputBox("Enter a new constant name:", "Add Constant Definition") If isBlank(newcons) Then Exit Sub ElseIf Not LCase(Left(newcons, 1)) Like "[a-z]" Then MsgBox "Constant must begin with A to Z." & vbCrLf & "(case insensitive)", vbExclamation, "New Constant" Exit Sub Else For lChar = 1 To Len(newcons) sChar = Mid(newcons, lChar, 1) If Not sChar Like "[_0-9A-Za-z]" Then MsgBox "Constant may only contain 0 to 9, underscore, or A to Z." & vbCrLf & "(case insensitive)", vbExclamation, "New Constant" Exit Sub End If Next lChar End If If inf.Modules("Main").Constants.Find(newcons) > 0 Then MsgBox "Constant already exists.", vbExclamation, "New Constant" Exit Sub End If inf.Modules("Main").Constants.Add newcons, "" lbConstants.AddItem newcons lbConstants.ListIndex = lbConstants.NewIndex End Sub Private Sub cbOkay_Click() Unload Me End Sub Private Sub cbRename_Click() Dim yn As String Dim newcons As String Dim tempcons As infNameValueDef newcons = InputBox("Rename '" & lbConstants.Text & "' to:", "Rename Constant") If isBlank(newcons) Then Exit Sub ElseIf Not LCase(Left(newcons, 1)) Like "[a-z]" Then MsgBox "Property must begin with A to Z." & vbCrLf & "(case insensitive)", vbExclamation, "Rename Constant" Exit Sub Else For lChar = 1 To Len(newcons) sChar = Mid(newcons, lChar, 1) If Not sChar Like "[_0-9A-Za-z]" Then MsgBox "Property may only contain 0 to 9, underscore, or A to Z." & vbCrLf & "(case insensitive)", vbExclamation, "Rename Constant" Exit Sub End If Next lChar End If If inf.Modules("Main").Constants.Find(newcons) > 0 Then MsgBox "Constant already exists.", vbExclamation, "Rename Constant" Exit Sub End If yn = MsgBox("Rename '" & lbConstants.Text & "' to '" & newcons & "'?", vbYesNoCancel, "Rename Constant") If yn = vbYes Then inf.Modules("Main").Constants.Add newcons, "" Set inf.Modules("Main").Constants(newcons).Comments = inf.Modules("Main").Constants(lbConstants.Text).Comments inf.Modules("Main").Constants.Remove lbConstants.Text Form_Load End If End Sub Private Sub lbConstants_Click() If LCase(lbConstants.Text) = "debug" Then cbRename.Enabled = False cbDelete.Enabled = True lblDebug.Visible = True txtValue.Visible = False txtValue.Enabled = False ElseIf InStr(1, "story headline", LCase(lbConstants.Text)) > 0 Then cbRename.Enabled = False cbDelete.Enabled = False lblDebug.Visible = False txtValue.Visible = True txtValue.Enabled = True txtValue.Text = inf.Modules("Main").Constants(lbConstants.Text).Value txtValue.SetFocus Else cbRename.Enabled = True cbDelete.Enabled = True lblDebug.Visible = False txtValue.Enabled = True txtValue.Text = inf.Modules("Main").Constants(lbConstants.Text).Value txtValue.SetFocus End If End Sub Private Sub txtValue_LostFocus() inf.Modules("Main").Constants(lbConstants.Text).Value = txtValue.Text txtValue = "" End Sub