home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / New_API_Vi2067375252007.psc / APIViewer / Forms / frmAddConst.frm next >
Text File  |  2007-04-13  |  24KB  |  664 lines

  1. VERSION 5.00
  2. Begin VB.Form frmAddConst 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Add New Constant to List"
  5.    ClientHeight    =   2520
  6.    ClientLeft      =   45
  7.    ClientTop       =   435
  8.    ClientWidth     =   8175
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   2520
  13.    ScaleWidth      =   8175
  14.    ShowInTaskbar   =   0   'False
  15.    StartUpPosition =   1  'CenterOwner
  16.    Begin VB.ComboBox cboConst 
  17.       BackColor       =   &H80000018&
  18.       BeginProperty Font 
  19.          Name            =   "Tahoma"
  20.          Size            =   8.25
  21.          Charset         =   0
  22.          Weight          =   400
  23.          Underline       =   0   'False
  24.          Italic          =   0   'False
  25.          Strikethrough   =   0   'False
  26.       EndProperty
  27.       Height          =   315
  28.       Left            =   4380
  29.       Style           =   2  'Dropdown List
  30.       TabIndex        =   5
  31.       ToolTipText     =   "Insert an established constant into the new constant value"
  32.       Top             =   1080
  33.       Width           =   3615
  34.    End
  35.    Begin VB.Timer tmractivate 
  36.       Enabled         =   0   'False
  37.       Interval        =   250
  38.       Left            =   3840
  39.       Top             =   1920
  40.    End
  41.    Begin VB.CommandButton cmdCancel 
  42.       Cancel          =   -1  'True
  43.       Caption         =   "Cancel"
  44.       BeginProperty Font 
  45.          Name            =   "Tahoma"
  46.          Size            =   8.25
  47.          Charset         =   0
  48.          Weight          =   400
  49.          Underline       =   0   'False
  50.          Italic          =   0   'False
  51.          Strikethrough   =   0   'False
  52.       EndProperty
  53.       Height          =   375
  54.       Left            =   6300
  55.       TabIndex        =   8
  56.       Top             =   1980
  57.       Width           =   1695
  58.    End
  59.    Begin VB.CommandButton cmdApply 
  60.       Caption         =   "Apply"
  61.       Default         =   -1  'True
  62.       BeginProperty Font 
  63.          Name            =   "Tahoma"
  64.          Size            =   8.25
  65.          Charset         =   0
  66.          Weight          =   400
  67.          Underline       =   0   'False
  68.          Italic          =   0   'False
  69.          Strikethrough   =   0   'False
  70.       EndProperty
  71.       Height          =   375
  72.       Left            =   4440
  73.       TabIndex        =   7
  74.       Top             =   1980
  75.       Width           =   1695
  76.    End
  77.    Begin VB.TextBox txtValue 
  78.       BeginProperty Font 
  79.          Name            =   "Courier New"
  80.          Size            =   8.25
  81.          Charset         =   0
  82.          Weight          =   700
  83.          Underline       =   0   'False
  84.          Italic          =   0   'False
  85.          Strikethrough   =   0   'False
  86.       EndProperty
  87.       Height          =   315
  88.       Left            =   2340
  89.       TabIndex        =   3
  90.       Top             =   600
  91.       Width           =   5655
  92.    End
  93.    Begin VB.TextBox txtName 
  94.       BeginProperty Font 
  95.          Name            =   "Tahoma"
  96.          Size            =   8.25
  97.          Charset         =   0
  98.          Weight          =   700
  99.          Underline       =   0   'False
  100.          Italic          =   0   'False
  101.          Strikethrough   =   0   'False
  102.       EndProperty
  103.       Height          =   315
  104.       Left            =   2340
  105.       TabIndex        =   1
  106.       Top             =   180
  107.       Width           =   5655
  108.    End
  109.    Begin VB.PictureBox PicPtrBack 
  110.       BorderStyle     =   0  'None
  111.       Height          =   195
  112.       Left            =   2340
  113.       ScaleHeight     =   195
  114.       ScaleWidth      =   5775
  115.       TabIndex        =   10
  116.       Top             =   900
  117.       Width           =   5775
  118.       Begin VB.PictureBox picptr 
  119.          BackColor       =   &H00000000&
  120.          BorderStyle     =   0  'None
  121.          Height          =   555
  122.          Left            =   0
  123.          ScaleHeight     =   555
  124.          ScaleWidth      =   75
  125.          TabIndex        =   11
  126.          ToolTipText     =   "Marker position on line (Click to change)"
  127.          Top             =   0
  128.          Width           =   75
  129.       End
  130.       Begin VB.Label lblRuler 
  131.          BackStyle       =   0  'Transparent
  132.          Caption         =   "....|....|....|....|....|....|....|....|....|....|...."
  133.          BeginProperty Font 
  134.             Name            =   "Courier New"
  135.             Size            =   8.25
  136.             Charset         =   0
  137.             Weight          =   700
  138.             Underline       =   0   'False
  139.             Italic          =   0   'False
  140.             Strikethrough   =   0   'False
  141.          EndProperty
  142.          Height          =   195
  143.          Left            =   0
  144.          TabIndex        =   12
  145.          ToolTipText     =   "Marker position on line (Click to change)"
  146.          Top             =   0
  147.          Width           =   5655
  148.       End
  149.    End
  150.    Begin VB.Label Label5 
  151.       AutoSize        =   -1  'True
  152.       BackStyle       =   0  'Transparent
  153.       Caption         =   "(Alignment aid)"
  154.       BeginProperty Font 
  155.          Name            =   "Tahoma"
  156.          Size            =   8.25
  157.          Charset         =   0
  158.          Weight          =   400
  159.          Underline       =   0   'False
  160.          Italic          =   0   'False
  161.          Strikethrough   =   0   'False
  162.       EndProperty
  163.       ForeColor       =   &H00800000&
  164.       Height          =   195
  165.       Left            =   840
  166.       TabIndex        =   14
  167.       Top             =   915
  168.       Width           =   1080
  169.    End
  170.    Begin VB.Label lblPosn 
  171.       AutoSize        =   -1  'True
  172.       BackStyle       =   0  'Transparent
  173.       Caption         =   "0"
  174.       BeginProperty Font 
  175.          Name            =   "Tahoma"
  176.          Size            =   8.25
  177.          Charset         =   0
  178.          Weight          =   400
  179.          Underline       =   0   'False
  180.          Italic          =   0   'False
  181.          Strikethrough   =   0   'False
  182.       EndProperty
  183.       Height          =   195
  184.       Left            =   2100
  185.       TabIndex        =   13
  186.       ToolTipText     =   "Marker position on line"
  187.       Top             =   900
  188.       Width           =   90
  189.    End
  190.    Begin VB.Label Label4 
  191.       AutoSize        =   -1  'True
  192.       BackStyle       =   0  'Transparent
  193.       Caption         =   "NOTE: Values can have trailing comments (ie, &&H12 'Offset is at 18)"
  194.       BeginProperty Font 
  195.          Name            =   "Tahoma"
  196.          Size            =   8.25
  197.          Charset         =   0
  198.          Weight          =   700
  199.          Underline       =   0   'False
  200.          Italic          =   0   'False
  201.          Strikethrough   =   0   'False
  202.       EndProperty
  203.       ForeColor       =   &H00800000&
  204.       Height          =   195
  205.       Left            =   240
  206.       TabIndex        =   9
  207.       Top             =   1500
  208.       Width           =   5625
  209.    End
  210.    Begin VB.Line Line2 
  211.       BorderColor     =   &H8000000E&
  212.       X1              =   240
  213.       X2              =   7980
  214.       Y1              =   1800
  215.       Y2              =   1800
  216.    End
  217.    Begin VB.Label lblInsert 
  218.       AutoSize        =   -1  'True
  219.       BackStyle       =   0  'Transparent
  220.       Caption         =   "Insert &Defined Constant:"
  221.       BeginProperty Font 
  222.          Name            =   "Tahoma"
  223.          Size            =   8.25
  224.          Charset         =   0
  225.          Weight          =   400
  226.          Underline       =   0   'False
  227.          Italic          =   0   'False
  228.          Strikethrough   =   0   'False
  229.       EndProperty
  230.       Height          =   195
  231.       Left            =   2400
  232.       TabIndex        =   4
  233.       ToolTipText     =   "Insert an established constant into the new constant value"
  234.       Top             =   1140
  235.       Width           =   1800
  236.    End
  237.    Begin VB.Label Label3 
  238.       BackStyle       =   0  'Transparent
  239.       Caption         =   "NOTE: Constants are considered valid if they do not clash with existing constants."
  240.       BeginProperty Font 
  241.          Name            =   "Tahoma"
  242.          Size            =   8.25
  243.          Charset         =   0
  244.          Weight          =   700
  245.          Underline       =   0   'False
  246.          Italic          =   0   'False
  247.          Strikethrough   =   0   'False
  248.       EndProperty
  249.       ForeColor       =   &H00800000&
  250.       Height          =   435
  251.       Left            =   240
  252.       TabIndex        =   6
  253.       Top             =   1920
  254.       Width           =   3675
  255.    End
  256.    Begin VB.Label Label2 
  257.       AutoSize        =   -1  'True
  258.       BackStyle       =   0  'Transparent
  259.       Caption         =   "Enter New Constant &Value:"
  260.       BeginProperty Font 
  261.          Name            =   "Tahoma"
  262.          Size            =   8.25
  263.          Charset         =   0
  264.          Weight          =   400
  265.          Underline       =   0   'False
  266.          Italic          =   0   'False
  267.          Strikethrough   =   0   'False
  268.       EndProperty
  269.       Height          =   195
  270.       Left            =   240
  271.       TabIndex        =   2
  272.       ToolTipText     =   "This value can be/include other constants, Dec, hex, octal, or binary values and +/- offsets"
  273.       Top             =   660
  274.       Width           =   1950
  275.    End
  276.    Begin VB.Label Label1 
  277.       AutoSize        =   -1  'True
  278.       BackStyle       =   0  'Transparent
  279.       Caption         =   "Enter New Constant &Name:"
  280.       BeginProperty Font 
  281.          Name            =   "Tahoma"
  282.          Size            =   8.25
  283.          Charset         =   0
  284.          Weight          =   400
  285.          Underline       =   0   'False
  286.          Italic          =   0   'False
  287.          Strikethrough   =   0   'False
  288.       EndProperty
  289.       Height          =   195
  290.       Left            =   240
  291.       TabIndex        =   0
  292.       ToolTipText     =   "Name to define new constant as"
  293.       Top             =   240
  294.       Width           =   1965
  295.    End
  296.    Begin VB.Line Line1 
  297.       BorderColor     =   &H80000015&
  298.       BorderWidth     =   2
  299.       X1              =   240
  300.       X2              =   7980
  301.       Y1              =   1800
  302.       Y2              =   1800
  303.    End
  304. End
  305. Attribute VB_Name = "frmAddConst"
  306. Attribute VB_GlobalNameSpace = False
  307. Attribute VB_Creatable = False
  308. Attribute VB_PredeclaredId = True
  309. Attribute VB_Exposed = False
  310. Option Explicit
  311.  
  312. '-------------------------------------------------------------------------------
  313. Private NameValid As Boolean  'true when name is not already defined
  314. Private ValueValid As Boolean 'considered valid if it contains anything
  315. Private MouseDown As Boolean  'True if mouse down over control
  316. '-------------------------------------------------------------------------------
  317.  
  318. '*******************************************************************************
  319. ' Subroutine Name   : Form_Activate
  320. ' Purpose           : Erase data on form when activated
  321. '*******************************************************************************
  322. Private Sub Form_Activate()
  323.   Me.txtName.Text = vbNullString
  324.   Me.txtValue.Text = vbNullString
  325.   Me.tmractivate.Enabled = True 'let timer set focus on name field
  326. End Sub
  327.  
  328. '*******************************************************************************
  329. ' Subroutine Name   : Form_Load
  330. ' Purpose           : Initialize form
  331. '*******************************************************************************
  332. Private Sub Form_Load()
  333.   Dim Idx As Integer
  334.   Dim I As Long, J As Long
  335.   Dim S As String
  336.   
  337.   Screen.MousePointer = vbHourglass         'show busy...
  338.   DoEvents
  339.   Me.Icon = frmCom.Icon                     'borrow an icon
  340. '
  341. ' start up with certain controls disabled
  342. '
  343.   Me.cmdApply.Enabled = False
  344.   Me.cboConst.Enabled = False
  345.   Me.lblInsert.Enabled = False
  346. '
  347. ' build combo list with constant names
  348. '
  349.   With frmCom.lstConst
  350.     For Idx = 0 To .ListCount - 1
  351.       S = .List(Idx)                        'grab a constant
  352.       I = InStr(7, S, " ")                  'find a space following name
  353.       J = InStr(7, S, "=")                  'find = following name
  354.       If J < I Then I = J                   'use lowest index
  355.       Me.cboConst.AddItem Mid$(S, 7, I - 7) 'add name only
  356.     Next Idx
  357.     Me.cboConst.ListIndex = -1              'do not point to anything
  358.   End With
  359. ''''--------------------------------------
  360. '''  With colConst
  361. '''    For Idx = 1 To .Count
  362. '''      Me.cboConst.AddItem .Item(Idx)
  363. '''    Next Idx
  364. '''  End With
  365. ''''--------------------------------------
  366.   With Me.picptr
  367.     .Left = CLng(GetSetting(App.Title, "Settings", "ConstPtr", "0"))
  368.     Me.lblPosn.Caption = CStr(Fix(.Left / Me.lblRuler.Width * 54) + 1)
  369.   End With
  370.   Screen.MousePointer = vbDefault           'no longer busy
  371. End Sub
  372.  
  373. '*******************************************************************************
  374. ' Subroutine Name   : Form_QueryUnload
  375. ' Purpose           : Intercept closing form via X button
  376. '*******************************************************************************
  377. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  378.   If UnloadMode = vbFormControlMenu Then
  379.     Me.Hide
  380.     Cancel = 1
  381.   End If
  382. End Sub
  383.  
  384. '*******************************************************************************
  385. ' Subroutine Name   : Form_Unload
  386. ' Purpose           : Save Pointer position
  387. '*******************************************************************************
  388. Private Sub Form_Unload(Cancel As Integer)
  389.   SaveSetting App.Title, "Settings", "ConstPtr", CStr(Me.picptr.Left)
  390. End Sub
  391.  
  392. '*******************************************************************************
  393. ' Routines support moving pointer on ruler
  394. '*******************************************************************************
  395. Private Sub PositionBar(Button As Integer, X As Single)
  396.   Dim Idx As Long, WInc As Long
  397.   
  398.   If Button And vbLeftButton Then
  399.     WInc = Me.lblRuler.Width \ 53
  400.     Idx = Fix(X / Me.lblRuler.Width * 53)
  401.     If Idx < 0 Or Idx > 53 Then Exit Sub
  402.     Me.lblPosn.Caption = CStr(Idx + 1)
  403.     If CBool(Idx) Then Idx = Idx * WInc ' - Me.picptr.Width / 2
  404.     Me.picptr.Left = Idx
  405.   End If
  406. End Sub
  407.  
  408. Private Sub lblRuler_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  409.   MouseDown = True
  410.   Call PositionBar(vbLeftButton, X)
  411. End Sub
  412.  
  413. Private Sub lblRuler_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  414.   If Button And vbLeftButton Then
  415.     Call PositionBar(vbLeftButton, X)
  416.   End If
  417. End Sub
  418.  
  419. Private Sub lblRuler_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  420.   MouseDown = True
  421. End Sub
  422.  
  423. Private Sub picptr_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  424.   MouseDown = True
  425.   Call PositionBar(vbLeftButton, CSng(Me.Left) + X)
  426. End Sub
  427.  
  428. Private Sub picptr_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  429.   Dim Lft As Long
  430.   
  431.   If Button And vbLeftButton Then
  432.     With Me.picptr
  433.       Lft = .Left - (.Width \ 2 - CLng(X))
  434.     End With
  435.     Call PositionBar(vbLeftButton, CSng(Lft))
  436.   End If
  437. End Sub
  438.  
  439. Private Sub picptr_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  440.   MouseDown = True
  441. End Sub
  442.  
  443. '*******************************************************************************
  444. ' Subroutine Name   : tmractivate_Timer
  445. ' Purpose           : Timer used because form could simply be hidden.
  446. '                   : This way we can reset focus to the first line
  447. '*******************************************************************************
  448. Private Sub tmractivate_Timer()
  449.   Me.tmractivate.Enabled = False
  450.   On Error Resume Next
  451.   Me.txtName.SetFocus
  452. End Sub
  453.  
  454. '*******************************************************************************
  455. ' Subroutine Name   : txtName_Change
  456. ' Purpose           : Check if entry is valid
  457. '*******************************************************************************
  458. Private Sub txtName_Change()
  459.   Dim Bol As Boolean
  460.   Dim S As String
  461.   
  462.   Bol = False                                     'init to failure
  463.   With Me.txtName
  464.     Bol = CBool(Len(.Text))                       'initially valid if it contains text
  465.     If Bol Then
  466.       Bol = Not IsNumeric(.Text)                  'do not allow starting with digit
  467.       If Bol Then
  468.         S = "Const " & .Text & " ="               'see if already defined
  469.         Bol = FindMatch(frmCom.lstConst, S) = -1  'valid if nothing found
  470.       End If
  471.     End If
  472.   End With
  473.   NameValid = Bol                                 'mark flag
  474.   Me.cboConst.Enabled = Bol                       'enable combo data if valid
  475.   Me.lblInsert.Enabled = Bol
  476.   
  477.   Me.cmdApply.Enabled = NameValid And ValueValid  'enable/disable apply button
  478. End Sub
  479.  
  480. '*******************************************************************************
  481. ' Subroutine Name   : txtName_KeyPress
  482. ' Purpose           : Filter keyboard so that invalid data cannot creep in
  483. '*******************************************************************************
  484. Private Sub txtName_KeyPress(KeyAscii As Integer)
  485.   Dim C As String
  486.   
  487.   Select Case KeyAscii
  488.     Case 1 To 31
  489.     Case Else
  490.       C = UCase$(Chr$(KeyAscii))          'get character from code
  491.       Select Case C
  492.         Case "A" To "Z", "0" To "9", "_"  'range of allowed text
  493.           KeyAscii = Asc(C)
  494.         Case Else
  495.           KeyAscii = 0                    'out of range
  496.       End Select
  497.   End Select
  498. End Sub
  499.  
  500. '*******************************************************************************
  501. ' Subroutine Name   : txtValue_Change
  502. ' Purpose           : Check if entry is valid
  503. '*******************************************************************************
  504. Private Sub txtValue_Change()
  505.   Dim S As String
  506.   
  507.   Me.lblRuler.ToolTipText = "column position: " & CStr(Me.txtValue.SelStart + 1)
  508.   S = Trim$(Me.txtValue.Text)
  509.   If Left$(S, 1) = "'" Then S = vbNullString        'if just comment, ignore
  510.   ValueValid = CBool(Len(Trim$(S)))                 'assume OK if ANY data
  511.   Me.cmdApply.Enabled = NameValid And ValueValid    'enable/disable apply button
  512. End Sub
  513.  
  514. '*******************************************************************************
  515. ' Subroutine Name   : txtValue_KeyDown
  516. ' Purpose           : Update cursor position
  517. '*******************************************************************************
  518. Private Sub txtValue_KeyDown(KeyCode As Integer, Shift As Integer)
  519.   Me.lblRuler.ToolTipText = "column position: " & CStr(Me.txtValue.SelStart + 1)
  520. End Sub
  521.  
  522. '*******************************************************************************
  523. ' Subroutine Name   : txtValue_KeyPress
  524. ' Purpose           : Filter keyboard so that invalid data cannot creep in
  525. '*******************************************************************************
  526. Private Sub txtValue_KeyPress(KeyAscii As Integer)
  527.   Dim C As String, S As String
  528.   Dim I As Long, J As Long, K As Long
  529.   Dim AllowLC As Boolean                    'True when lowercase text allowed
  530.   
  531.   J = -1
  532.   With Me.txtValue
  533.     S = .Text                               'grab text
  534.     I = InStr(1, S, "'")                    'comment present?
  535.     If CBool(I) Then J = .SelStart + 1      'if so, check for selection point
  536.   End With
  537.   AllowLC = J >= I                          'set lowercase allowance flag
  538.   
  539.   S = Trim$(Me.txtValue.Text)
  540.   Select Case KeyAscii
  541.     Case 1 To 31
  542.     Case Else
  543.       C = UCase$(Chr$(KeyAscii))            'get text version of code
  544.       If CBool(InStr(1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ &1234567890()'", C)) Then
  545.         If Not AllowLC Then
  546.           KeyAscii = Asc(C)
  547.         End If
  548.         Call TestValue
  549.       ElseIf CBool(InStr(1, "+-", C)) Then  'if math involved, ensure enbraced by parens
  550.         S = Trim$(Me.txtValue.Text)
  551.         If Left$(S, 1) <> "(" Then          'no paren?
  552.           S = "(" & S & ")"                 'no, so enclose it
  553.           With Me.txtValue
  554.             .Text = S
  555.             .SelStart = Len(S) - 1          'set insert point immediately before ')'
  556.           End With
  557.         End If
  558.       Else
  559.         KeyAscii = 0                        'invalid data
  560.       End If
  561.   End Select
  562. End Sub
  563.  
  564. '*******************************************************************************
  565. ' Subroutine Name   : TestValue
  566. ' Purpose           : Ensure logical entries are properly formatted
  567. '                   : (not necessary, but just for looks)
  568. '*******************************************************************************
  569. Private Sub TestValue()
  570.   Dim S As String
  571.   Dim Idx As Long
  572.   Dim Bol As Boolean
  573.   
  574.   With Me.txtValue
  575.     S = " " & .Text               'prepend space in case we start with "Not"
  576.     
  577.     Idx = InStr(1, S, " OR ")     'found Ucase OR?
  578.     Do While CBool(Idx)
  579.       Mid$(S, Idx, 3) = " Or"     'yes, fix it
  580.       Idx = InStr(Idx + 3, S, " OR ")
  581.     Loop
  582.     
  583.     Idx = InStr(1, S, " AND ")    'found Ucase AND?
  584.     Do While CBool(Idx)
  585.       Mid$(S, Idx, 4) = " And"
  586.       Idx = InStr(Idx + 4, S, " AND ")
  587.     Loop
  588.     
  589.     Idx = InStr(1, S, " XOR ")    'found Ucase XOR?
  590.     Do While CBool(Idx)
  591.       Mid$(S, Idx, 4) = " Xor"
  592.       Idx = InStr(Idx + 4, S, " XOR ")
  593.     Loop
  594.     
  595.     Idx = InStr(1, S, " NOT ")    'found Ucase NOT?
  596.     Do While CBool(Idx)
  597.       Mid$(S, Idx, 4) = " Not"
  598.       Idx = InStr(Idx + 4, S, " NOT ")
  599.     Loop
  600.     '
  601.     ' if we fodund any logical flags, ensure expression embraced
  602.     '
  603.     If CBool(InStr(1, S, " Or ")) Or _
  604.        CBool(InStr(1, S, " And ")) Or _
  605.        CBool(InStr(1, S, " Xor ")) Or _
  606.        CBool(InStr(1, S, " Not ")) Then
  607.       If Left$(S, 2) <> " (" Then   'paren?
  608.         S = " (" & Mid$(S, 2) & ")" 'no, so enclose it
  609.         Idx = .SelStart
  610.         .Text = Mid$(S, 2)
  611.         .SelStart = Idx + 1         'set insert point immediately before ')'
  612.       End If
  613.     End If
  614.   End With
  615. End Sub
  616.  
  617. '*******************************************************************************
  618. ' Subroutine Name   : cboConst_Click
  619. ' Purpose           : append a defined constant
  620. '*******************************************************************************
  621. Private Sub cboConst_Click()
  622.   Dim Idx As Long
  623.   
  624.   On Error Resume Next
  625.   With Me.txtValue
  626.     Idx = .SelStart + Len(Me.cboConst.Text) 'define insertion point
  627.     .SelText = Me.cboConst.Text             'insert selection
  628.     .SelStart = Idx                         'set insert point after added text
  629.     .SetFocus
  630.   End With
  631. End Sub
  632.  
  633. '*******************************************************************************
  634. ' Subroutine Name   : cmdCancel_Click
  635. ' Purpose           : Cancel dialog
  636. '*******************************************************************************
  637. Private Sub cmdCancel_Click()
  638.   Me.Hide                                   'hiding helps prevent long rebuild of Const Combobox
  639. End Sub
  640.  
  641. '*******************************************************************************
  642. ' Subroutine Name   : cmdApply_Click
  643. ' Purpose           : Apply change
  644. '*******************************************************************************
  645. Private Sub cmdApply_Click()
  646.   Call TestValue                            'check value for logical entries
  647.   Call ApplyChanges                         'add changes user made
  648.   Me.Hide                                   'hiding helps prevent long rebuild of Const Combobox
  649. End Sub
  650.  
  651. '*******************************************************************************
  652. ' Subroutine Name   : ApplyChanges
  653. ' Purpose           : Apply chages to user list of declarations
  654. '*******************************************************************************
  655. Private Sub ApplyChanges()
  656.   DeclChange = "Const " & Me.txtName & " = " & Me.txtValue  'set declaration for new entry
  657.   DeclName = Me.txtName.Text                                'new routine name
  658. End Sub
  659.  
  660. '******************************************************************************
  661. ' Copyright 1990-2007 David Ross Goben. All rights reserved.
  662. '******************************************************************************
  663.  
  664.