home *** CD-ROM | disk | FTP | other *** search
/ Chip: Windows 2000 Professional Resource Kit / W2KPRK.iso / apps / crystal / disk18 / Xvb231._ / Xvb231. (.txt)
Encoding:
Visual Basic Form  |  1999-08-23  |  34.1 KB  |  965 lines

  1. VERSION 5.00
  2. Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.1#0"; "RICHTX32.OCX"
  3. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0"; "COMCTL32.OCX"
  4. Begin VB.Form frmMain 
  5.    Caption         =   "Seagate Crystal Report Engine Automation Server"
  6.    ClientHeight    =   6450
  7.    ClientLeft      =   210
  8.    ClientTop       =   1710
  9.    ClientWidth     =   9480
  10.    Icon            =   "Main.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   6450
  13.    ScaleWidth      =   9480
  14.    Begin ComctlLib.Toolbar tbToolbar 
  15.       Align           =   1  'Align Top
  16.       Height          =   420
  17.       Left            =   0
  18.       TabIndex        =   6
  19.       Top             =   300
  20.       Width           =   9480
  21.       _ExtentX        =   16722
  22.       _ExtentY        =   741
  23.       ButtonWidth     =   635
  24.       ButtonHeight    =   582
  25.       Appearance      =   1
  26.       ImageList       =   "imlIcons"
  27.       _Version        =   327680
  28.       BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7} 
  29.          NumButtons      =   14
  30.          BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  31.             Key             =   "Bacx"
  32.             Object.ToolTipText     =   "Back"
  33.             Object.Tag             =   ""
  34.             Style           =   3
  35.             MixedState      =   -1  'True
  36.          EndProperty
  37.          BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  38.             Key             =   "Back"
  39.             Object.ToolTipText     =   "Back"
  40.             Object.Tag             =   ""
  41.             ImageIndex      =   1
  42.          EndProperty
  43.          BeginProperty Button3 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  44.             Key             =   "Forward"
  45.             Object.ToolTipText     =   "Forward"
  46.             Object.Tag             =   ""
  47.             ImageIndex      =   2
  48.          EndProperty
  49.          BeginProperty Button4 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  50.             Key             =   ""
  51.             Object.Tag             =   ""
  52.             Style           =   3
  53.             MixedState      =   -1  'True
  54.          EndProperty
  55.          BeginProperty Button5 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  56.             Object.Visible         =   0   'False
  57.             Key             =   "Save"
  58.             Object.ToolTipText     =   "Save"
  59.             Object.Tag             =   ""
  60.             ImageIndex      =   19
  61.          EndProperty
  62.          BeginProperty Button6 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  63.             Object.Visible         =   0   'False
  64.             Key             =   ""
  65.             Object.Tag             =   ""
  66.             Style           =   3
  67.             MixedState      =   -1  'True
  68.          EndProperty
  69.          BeginProperty Button7 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  70.             Object.Visible         =   0   'False
  71.             Key             =   "Cut"
  72.             Object.ToolTipText     =   "Cut"
  73.             Object.Tag             =   ""
  74.             ImageIndex      =   3
  75.          EndProperty
  76.          BeginProperty Button8 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  77.             Key             =   "Copy"
  78.             Object.ToolTipText     =   "Copy"
  79.             Object.Tag             =   ""
  80.             ImageIndex      =   4
  81.          EndProperty
  82.          BeginProperty Button9 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  83.             Object.Visible         =   0   'False
  84.             Key             =   "Paste"
  85.             Object.ToolTipText     =   "Paste"
  86.             Object.Tag             =   ""
  87.             ImageIndex      =   5
  88.          EndProperty
  89.          BeginProperty Button10 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  90.             Object.Visible         =   0   'False
  91.             Key             =   "Delete"
  92.             Object.ToolTipText     =   "Delete"
  93.             Object.Tag             =   ""
  94.             ImageIndex      =   6
  95.          EndProperty
  96.          BeginProperty Button11 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  97.             Object.Visible         =   0   'False
  98.             Key             =   ""
  99.             Object.Tag             =   ""
  100.             Style           =   3
  101.             MixedState      =   -1  'True
  102.          EndProperty
  103.          BeginProperty Button12 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  104.             Object.Visible         =   0   'False
  105.             Key             =   "Bold"
  106.             Object.ToolTipText     =   "Bold"
  107.             Object.Tag             =   ""
  108.             ImageIndex      =   7
  109.          EndProperty
  110.          BeginProperty Button13 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  111.             Object.Visible         =   0   'False
  112.             Key             =   "Italic"
  113.             Object.ToolTipText     =   "Italic"
  114.             Object.Tag             =   ""
  115.             ImageIndex      =   8
  116.          EndProperty
  117.          BeginProperty Button14 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  118.             Object.Visible         =   0   'False
  119.             Key             =   "Underline"
  120.             Object.ToolTipText     =   "Underline"
  121.             Object.Tag             =   ""
  122.             ImageIndex      =   9
  123.          EndProperty
  124.       EndProperty
  125.       MouseIcon       =   "Main.frx":030A
  126.    End
  127.    Begin ComctlLib.StatusBar sbStatusBar 
  128.       Align           =   2  'Align Bottom
  129.       Height          =   285
  130.       Left            =   0
  131.       TabIndex        =   0
  132.       Top             =   6165
  133.       Width           =   9480
  134.       _ExtentX        =   16722
  135.       _ExtentY        =   503
  136.       SimpleText      =   ""
  137.       _Version        =   327680
  138.       BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} 
  139.          NumPanels       =   3
  140.          BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
  141.             AutoSize        =   1
  142.             Object.Width           =   11086
  143.             Text            =   "Status"
  144.             TextSave        =   "Status"
  145.             Key             =   ""
  146.             Object.Tag             =   ""
  147.          EndProperty
  148.          BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
  149.             Style           =   6
  150.             AutoSize        =   2
  151.             TextSave        =   "8/15/97"
  152.             Key             =   ""
  153.             Object.Tag             =   ""
  154.          EndProperty
  155.          BeginProperty Panel3 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
  156.             Style           =   5
  157.             AutoSize        =   2
  158.             TextSave        =   "3:25 PM"
  159.             Key             =   ""
  160.             Object.Tag             =   ""
  161.          EndProperty
  162.       EndProperty
  163.       MouseIcon       =   "Main.frx":0326
  164.    End
  165.    Begin ComctlLib.TreeView tvTreeView 
  166.       Height          =   5040
  167.       Left            =   0
  168.       TabIndex        =   4
  169.       Top             =   735
  170.       Width           =   3930
  171.       _ExtentX        =   6932
  172.       _ExtentY        =   8890
  173.       _Version        =   327680
  174.       HideSelection   =   0   'False
  175.       Indentation     =   529
  176.       Style           =   7
  177.       ImageList       =   "imlObjects"
  178.       Appearance      =   1
  179.       MouseIcon       =   "Main.frx":0342
  180.    End
  181.    Begin VB.PictureBox picTitles 
  182.       Align           =   1  'Align Top
  183.       Appearance      =   0  'Flat
  184.       BorderStyle     =   0  'None
  185.       ForeColor       =   &H80000008&
  186.       Height          =   300
  187.       Left            =   0
  188.       ScaleHeight     =   300
  189.       ScaleWidth      =   9480
  190.       TabIndex        =   1
  191.       TabStop         =   0   'False
  192.       Top             =   0
  193.       Width           =   9480
  194.       Begin VB.Label lblTitle 
  195.          BorderStyle     =   1  'Fixed Single
  196.          Caption         =   "Details"
  197.          Height          =   270
  198.          Index           =   1
  199.          Left            =   2205
  200.          TabIndex        =   3
  201.          Tag             =   " ListView:"
  202.          Top             =   15
  203.          Width           =   9300
  204.       End
  205.       Begin VB.Label lblTitle 
  206.          BorderStyle     =   1  'Fixed Single
  207.          Caption         =   "Crystal Objects"
  208.          Height          =   270
  209.          Index           =   0
  210.          Left            =   120
  211.          TabIndex        =   2
  212.          Tag             =   " TreeView:"
  213.          Top             =   15
  214.          Width           =   2010
  215.       End
  216.    End
  217.    Begin RichTextLib.RichTextBox rtxtCode 
  218.       Height          =   5040
  219.       Left            =   4140
  220.       TabIndex        =   5
  221.       Top             =   705
  222.       Width           =   7365
  223.       _ExtentX        =   12991
  224.       _ExtentY        =   8890
  225.       _Version        =   327680
  226.       Enabled         =   -1  'True
  227.       HideSelection   =   0   'False
  228.       ScrollBars      =   2
  229.       RightMargin     =   5
  230.       AutoVerbMenu    =   -1  'True
  231.       OLEDragMode     =   0
  232.       OLEDropMode     =   0
  233.       TextRTF         =   $"Main.frx":035E
  234.    End
  235.    Begin ComctlLib.ImageList imlObjects 
  236.       Left            =   1485
  237.       Top             =   5640
  238.       _ExtentX        =   1005
  239.       _ExtentY        =   1005
  240.       BackColor       =   -2147483643
  241.       ImageWidth      =   16
  242.       ImageHeight     =   16
  243.       MaskColor       =   12632256
  244.       _Version        =   327680
  245.       BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
  246.          NumListImages   =   5
  247.          BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  248.             Picture         =   "Main.frx":0445
  249.             Key             =   "Event"
  250.          EndProperty
  251.          BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  252.             Picture         =   "Main.frx":075F
  253.             Key             =   "CRPE"
  254.          EndProperty
  255.          BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  256.             Picture         =   "Main.frx":0A79
  257.             Key             =   "Method"
  258.          EndProperty
  259.          BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  260.             Picture         =   "Main.frx":0D93
  261.             Key             =   "Property"
  262.          EndProperty
  263.          BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  264.             Picture         =   "Main.frx":10AD
  265.             Key             =   "Object"
  266.          EndProperty
  267.       EndProperty
  268.    End
  269.    Begin VB.Image imgSplitter 
  270.       Height          =   5040
  271.       Left            =   3960
  272.       MousePointer    =   9  'Size W E
  273.       Top             =   735
  274.       Width           =   150
  275.    End
  276.    Begin ComctlLib.ImageList imlIcons 
  277.       Left            =   840
  278.       Top             =   5730
  279.       _ExtentX        =   1005
  280.       _ExtentY        =   1005
  281.       BackColor       =   -2147483643
  282.       ImageWidth      =   16
  283.       ImageHeight     =   16
  284.       MaskColor       =   12632256
  285.       _Version        =   327680
  286.       BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
  287.          NumListImages   =   19
  288.          BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  289.             Picture         =   "Main.frx":13C7
  290.             Key             =   ""
  291.          EndProperty
  292.          BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  293.             Picture         =   "Main.frx":1919
  294.             Key             =   ""
  295.          EndProperty
  296.          BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  297.             Picture         =   "Main.frx":1E6B
  298.             Key             =   ""
  299.          EndProperty
  300.          BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  301.             Picture         =   "Main.frx":23BD
  302.             Key             =   ""
  303.          EndProperty
  304.          BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  305.             Picture         =   "Main.frx":290F
  306.             Key             =   ""
  307.          EndProperty
  308.          BeginProperty ListImage6 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  309.             Picture         =   "Main.frx":2E61
  310.             Key             =   ""
  311.          EndProperty
  312.          BeginProperty ListImage7 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  313.             Picture         =   "Main.frx":33B3
  314.             Key             =   ""
  315.          EndProperty
  316.          BeginProperty ListImage8 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  317.             Picture         =   "Main.frx":34C5
  318.             Key             =   ""
  319.          EndProperty
  320.          BeginProperty ListImage9 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  321.             Picture         =   "Main.frx":35D7
  322.             Key             =   ""
  323.          EndProperty
  324.          BeginProperty ListImage10 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  325.             Picture         =   "Main.frx":36E9
  326.             Key             =   "Item"
  327.          EndProperty
  328.          BeginProperty ListImage11 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  329.             Picture         =   "Main.frx":3C3B
  330.             Key             =   ""
  331.          EndProperty
  332.          BeginProperty ListImage12 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  333.             Picture         =   "Main.frx":418D
  334.             Key             =   ""
  335.          EndProperty
  336.          BeginProperty ListImage13 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  337.             Picture         =   "Main.frx":46DF
  338.             Key             =   ""
  339.          EndProperty
  340.          BeginProperty ListImage14 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  341.             Picture         =   "Main.frx":4C31
  342.             Key             =   ""
  343.          EndProperty
  344.          BeginProperty ListImage15 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  345.             Picture         =   "Main.frx":5183
  346.             Key             =   "closedfldr"
  347.          EndProperty
  348.          BeginProperty ListImage16 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  349.             Picture         =   "Main.frx":549D
  350.             Key             =   "OpenFolder"
  351.          EndProperty
  352.          BeginProperty ListImage17 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  353.             Picture         =   "Main.frx":57B7
  354.             Key             =   "CRPE"
  355.          EndProperty
  356.          BeginProperty ListImage18 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  357.             Picture         =   "Main.frx":5AD1
  358.             Key             =   "Object"
  359.          EndProperty
  360.          BeginProperty ListImage19 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  361.             Picture         =   "Main.frx":5DEB
  362.             Key             =   "Save"
  363.          EndProperty
  364.       EndProperty
  365.    End
  366.    Begin VB.Menu mnuFile 
  367.       Caption         =   "&File"
  368.       Begin VB.Menu mnuFileExit 
  369.          Caption         =   "E&xit"
  370.       End
  371.    End
  372.    Begin VB.Menu mnuEdit 
  373.       Caption         =   "&Edit"
  374.       Begin VB.Menu mnuEditCopy 
  375.          Caption         =   "&Copy"
  376.          Shortcut        =   ^C
  377.       End
  378.    End
  379.    Begin VB.Menu mnuView 
  380.       Caption         =   "&View"
  381.       Begin VB.Menu mnuViewToolbar 
  382.          Caption         =   "&Toolbar"
  383.          Checked         =   -1  'True
  384.       End
  385.       Begin VB.Menu mnuViewStatusBar 
  386.          Caption         =   "Status &Bar"
  387.          Checked         =   -1  'True
  388.       End
  389.    End
  390.    Begin VB.Menu mnuHelp 
  391.       Caption         =   "&Help"
  392.       Begin VB.Menu mnuHelpContents 
  393.          Caption         =   "&Contents"
  394.       End
  395.       Begin VB.Menu mnuHelpSearch 
  396.          Caption         =   "&Search For Help On..."
  397.       End
  398.    End
  399. Attribute VB_Name = "frmMain"
  400. Attribute VB_GlobalNameSpace = False
  401. Attribute VB_Creatable = False
  402. Attribute VB_PredeclaredId = True
  403. Attribute VB_Exposed = False
  404. Option Explicit
  405. Private Declare Function OSWinHelp% Lib "user32" Alias "WinHelpA" (ByVal hwnd&, ByVal HelpFile$, ByVal wCommand%, dwData As Any)
  406. Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
  407. Private Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal lpFileName As String) As Long
  408. Private m_bMoving As Boolean
  409. Private m_nodX As Node
  410. Private m_DirtyFlag As DirtyFlag
  411. Private m_DirtyNode As String
  412. Private m_Response As Integer
  413. Private m_bLoadingRTF As Boolean
  414. Private m_strTemp As String
  415. Private m_bAdded As Boolean
  416. Const sglSplitLimit = 500
  417. Private Sub cmdExit_Click()
  418. ' quit application
  419.     On Error Resume Next
  420.     Unload Me
  421. End Sub
  422. Private Sub Form_Load()
  423. ' restore last window settings,
  424. '   load the treelist with Automation Server object names
  425.     Dim Index As Integer 'Node counter
  426.     On Error GoTo Form_Load_Err:
  427.     'retain screen settings from last session
  428.     Me.Left = GetSetting(App.Title, "Settings", "MainLeft", 1000)
  429.     Me.Top = GetSetting(App.Title, "Settings", "MainTop", 1000)
  430.     Me.Width = GetSetting(App.Title, "Settings", "MainWidth", 6500)
  431.     Me.Height = GetSetting(App.Title, "Settings", "MainHeight", 6500)
  432.      'add Automation Server objects to TreeView
  433.     GetNodeFromIniFile
  434.     'expand the first level by default
  435.     tvTreeView.Nodes(1).Expanded = True
  436.     'disable label editing
  437.     tvTreeView.LabelEdit = tvwManual
  438.     'load the rtf file for the root node
  439.     rtxtCode.filename = App.Path & "\Source\CRPEAuto.rtf"
  440. Form_Load_Exit:
  441.     Exit Sub
  442. Form_Load_Err:
  443.     MsgBox Error$
  444.     GoTo Form_Load_Exit:
  445.     Resume 0
  446. End Sub
  447. Private Sub Form_Unload(Cancel As Integer)
  448. ' Save window settings, prompt to save dirty objects
  449.   Dim i As Integer
  450.   ' check dirtyflags, save dirty stuff
  451.   If m_DirtyFlag.TreeView Then
  452.     If MsgBox("Save Object List?", vbInformation + vbOKCancel, "Unsaved Data Warning") = vbOK Then
  453.       SaveObjectList
  454.     End If
  455.   End If
  456.   'close all sub forms
  457.   For i = Forms.Count - 1 To 1 Step -1
  458.       Unload Forms(i)
  459.   Next
  460.   If Me.WindowState <> vbMinimized Then
  461.       SaveSetting App.Title, "Settings", "MainLeft", Me.Left
  462.       SaveSetting App.Title, "Settings", "MainTop", Me.Top
  463.       SaveSetting App.Title, "Settings", "MainWidth", Me.Width
  464.       SaveSetting App.Title, "Settings", "MainHeight", Me.Height
  465.   End If
  466. End Sub
  467. Private Sub mnuFileSave_Click()
  468. ' save the current Richtext object
  469.   On Error GoTo mnuFileSave_Click_Err:
  470.   MousePointer = vbHourglass
  471.   'Dim strFilename As String
  472.   'strFilename = rtxtCode.filename
  473.   rtxtCode.SaveFile rtxtCode.filename
  474.   m_DirtyFlag.rtf = False ' made it here with no error, file was saved
  475. mnuFileSave_Click_Exit:
  476.   MousePointer = vbDefault
  477.   Exit Sub
  478. mnuFileSave_Click_Err:
  479.   MsgBox Error$
  480.   GoTo mnuFileSave_Click_Exit:
  481. End Sub
  482. Private Sub mnuViewBrowser_Click()
  483.     'Dim frmB As New frmBrowser
  484.     'frmB.StartingAddress = "http://elvis/aristotle/default.asp"
  485.     'frmB.Show
  486. End Sub
  487. Private Sub mnuFileExit_Click()
  488.     ' Unload Form
  489.     Unload Me
  490. End Sub
  491. Private Sub mnuViewStatusBar_Click()
  492.     If mnuViewStatusBar.Checked Then
  493.         sbStatusBar.Visible = False
  494.         mnuViewStatusBar.Checked = False
  495.     Else
  496.         sbStatusBar.Visible = True
  497.         mnuViewStatusBar.Checked = True
  498.     End If
  499.     SizeControls imgSplitter.Left
  500. End Sub
  501. Private Sub mnuViewToolbar_Click()
  502.     If mnuViewToolbar.Checked Then
  503.         tbToolbar.Visible = False
  504.         mnuViewToolbar.Checked = False
  505.     Else
  506.         tbToolbar.Visible = True
  507.         mnuViewToolbar.Checked = True
  508.     End If
  509.     SizeControls imgSplitter.Left
  510. End Sub
  511. Private Sub Form_Resize()
  512.   Static bDone As Boolean
  513.     On Error Resume Next
  514.     SizeControls imgSplitter.Left
  515. End Sub
  516. Private Sub imgSplitter_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  517.     With imgSplitter
  518.         rtxtCode.Move .Left, .Top, .Width \ 2, .Height - 20
  519.     End With
  520.     m_bMoving = True
  521. End Sub
  522. Private Sub imgSplitter_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  523.     Dim sglPos As Single
  524.     If m_bMoving Then
  525.         sglPos = x + imgSplitter.Left
  526.         If sglPos < sglSplitLimit Then
  527.             rtxtCode.Left = sglSplitLimit
  528.         ElseIf sglPos > Me.Width - sglSplitLimit Then
  529.             rtxtCode.Left = Me.Width - sglSplitLimit
  530.         Else
  531.             rtxtCode.Left = sglPos
  532.         End If
  533.     End If
  534. End Sub
  535. Private Sub imgSplitter_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  536.     SizeControls rtxtCode.Left
  537.     rtxtCode.Visible = True
  538.     m_bMoving = False
  539. End Sub
  540. Sub SizeControls(x As Single)
  541.     On Error Resume Next
  542.     Dim intHeight As Integer
  543.     'set the width
  544.     If x < 1500 Then x = 1500
  545.     If x > (Me.Width - 1500) Then x = Me.Width - 1500
  546.     tvTreeView.Width = x
  547.     imgSplitter.Left = x
  548.     rtxtCode.Left = x + 40
  549.     rtxtCode.Width = Me.Width - (tvTreeView.Width + 140)
  550.     lblTitle(0).Width = tvTreeView.Width
  551.     lblTitle(1).Left = rtxtCode.Left + 20
  552.     lblTitle(1).Width = rtxtCode.Width - 40
  553.     'set the top
  554.     If tbToolbar.Visible Then
  555.         tvTreeView.Top = tbToolbar.Height + picTitles.Height
  556.     Else
  557.         tvTreeView.Top = picTitles.Height
  558.     End If
  559.     rtxtCode.Top = tvTreeView.Top
  560.     If sbStatusBar.Visible Then
  561.         If tbToolbar.Visible Then
  562.             'take off the status bar height if it is not visible
  563.             intHeight = Me.ScaleHeight - (picTitles.Height + sbStatusBar.Height + tbToolbar.Height)
  564.         Else
  565.             intHeight = Me.ScaleHeight - (picTitles.Height + sbStatusBar.Height)
  566.         End If
  567.     Else
  568.         If tbToolbar.Visible Then
  569.             intHeight = Me.ScaleHeight - (picTitles.Height + tbToolbar.Height)
  570.         Else
  571.             intHeight = Me.ScaleHeight - picTitles.Height
  572.         End If
  573.     End If
  574.     tvTreeView.Height = intHeight
  575.     rtxtCode.Height = intHeight
  576.     imgSplitter.Top = tvTreeView.Top
  577.     imgSplitter.Height = intHeight
  578. End Sub
  579. Private Sub rtxtCode_Change()
  580.     If Not m_bLoadingRTF Then
  581.         m_DirtyFlag.rtf = True
  582.     End If
  583. End Sub
  584. Private Sub tbToolBar_ButtonClick(ByVal Button As ComctlLib.Button)
  585.     Select Case Button.Key
  586.         Case "Back"
  587.             If Not tvTreeView.SelectedItem.Parent Is Nothing Then
  588.                 tvTreeView.SelectedItem = tvTreeView.SelectedItem.Parent
  589.             End If
  590.         Case "Forward"
  591.             If Not tvTreeView.SelectedItem.Child Is Nothing Then
  592.                 tvTreeView.SelectedItem = tvTreeView.SelectedItem.Child
  593.             End If
  594.         Case "Cut"
  595.             'mnuEditCut_Click
  596.         Case "Copy"
  597.             mnuEditCopy_Click
  598.         Case "Paste"
  599.             'mnuEditPaste_Click
  600.         Case "Delete"
  601.             'mnuFileDelete_Click
  602.         Case "Properties"
  603.             'mnuFileProperties_Click
  604.         Case "Save"
  605.             'rtxtCode.SaveFile App.Path & "\" & tvTreeView.SelectedItem.Text & ".rtf"
  606.             'mnuFileSave_Click
  607.         Case "bold"
  608.           'togglebuttonvalue Button
  609.           'rtxtCode.SelBold = (Button.Value = tbrPressed)
  610.         Case "italic"
  611.           'togglebuttonvalue Button
  612.           'rtxtCode.SelItalic = (Button.Value = tbrPressed)
  613.         Case "underline"
  614.           'togglebuttonvalue Button
  615.           'rtxtCode.SelUnderline = (Button.Value = tbrPressed)
  616.     End Select
  617. End Sub
  618. Private Sub mnuHelpContents_Click()
  619.     Dim nRet As Integer
  620.     'if there is no helpfile for this project display a message to the user
  621.     'you can set the HelpFile for your application in the
  622.     'Project Properties dialog
  623.     If Len(App.HelpFile) = 0 Then
  624.         MsgBox "Unable to display Help Contents. There is no Help associated with this project.", vbInformation, Me.Caption
  625.     Else
  626.         On Error Resume Next
  627.         nRet = OSWinHelp(Me.hwnd, App.HelpFile, 3, 0)
  628.         If Err Then
  629.             MsgBox Err.Description
  630.         End If
  631.     End If
  632. End Sub
  633. Private Sub mnuHelpSearch_Click()
  634.     Dim nRet As Integer
  635.     'if there is no helpfile for this project display a message to the user
  636.     'you can set the HelpFile for your application in the
  637.     'Project Properties dialog
  638.     If Len(App.HelpFile) = 0 Then
  639.         MsgBox "Unable to display Help Contents. There is no Help associated with this project.", vbInformation, Me.Caption
  640.     Else
  641.         On Error Resume Next
  642.         nRet = OSWinHelp(Me.hwnd, App.HelpFile, 261, 0)
  643.         If Err Then
  644.             MsgBox Err.Description
  645.         End If
  646.     End If
  647. End Sub
  648. Private Sub mnuViewRefresh_Click()
  649.     'To Do
  650.     'MsgBox "Refresh Code goes here!"
  651. End Sub
  652. Private Sub mnuEditCopy_Click()
  653.     Clipboard.Clear
  654.     Clipboard.SetText rtxtCode.SelText, vbCFText
  655. End Sub
  656. Private Sub mnuEditCut_Click()
  657.     'To Do
  658.     'MsgBox "Cut Code goes here!"
  659. End Sub
  660. Private Sub mnuEditDSelectAll_Click()
  661.     'To Do
  662.     'MsgBox "Select All Code goes here!"
  663. End Sub
  664. Private Sub mnuEditInvertSelection_Click()
  665.     'To Do
  666.     'MsgBox "Invert Selection Code goes here!"
  667. End Sub
  668. Private Sub mnuEditPaste_Click()
  669.     'To Do
  670.     'MsgBox "Paste Code goes here!"
  671. End Sub
  672. Private Sub mnuEditPasteSpecial_Click()
  673.     'To Do
  674.     'MsgBox "Paste Special Code goes here!"
  675. End Sub
  676. Private Sub mnuEditUndo_Click()
  677.     'To Do
  678.     'MsgBox "Undo Code goes here!"
  679. End Sub
  680. Private Sub mnuFileOpen_Click()
  681.     'To Do
  682.     'MsgBox "Open Code goes here!"
  683. End Sub
  684. Private Sub mnuFileFind_Click()
  685.     'To Do
  686.     'MsgBox "Find Code goes here!"
  687. End Sub
  688. Private Sub mnuFileSendTo_Click()
  689.     'To Do
  690.     'MsgBox "Send To Code goes here!"
  691. End Sub
  692. Private Sub mnuFileNew_Click()
  693.     'To Do
  694.     'MsgBox "New File Code goes here!"
  695. End Sub
  696. Private Sub mnuFileDelete_Click()
  697.     'To Do
  698.     'MsgBox "Delete Code goes here!"
  699. End Sub
  700. Private Sub mnuFileRename_Click()
  701.     'To Do
  702.     'MsgBox "Rename Code goes here!"
  703. End Sub
  704. Private Sub mnuFileProperties_Click()
  705.     'To Do
  706.     'MsgBox "Properties Code goes here!"
  707. End Sub
  708. Private Sub mnuFileMRU_Click(Index As Integer)
  709.     'To Do
  710.     'MsgBox "MRU Code goes here!"
  711. End Sub
  712. Private Sub tvTreeView_NodeClick(ByVal Node As ComctlLib.Node)
  713. '   Display sample code for the selected node
  714.     On Error GoTo tvTreeView_NodeClick_Err:
  715.     Dim lngResult As Long
  716.     Dim strFileName As String
  717.     Dim strDash As String
  718.     Dim strParent As String
  719.     '*****************************************
  720.     '* temporary desabled
  721.     '*****************************************
  722.     ' tell Change event not to set dirty flag
  723.     'm_bLoadingRTF = True
  724.     Node.Selected = True
  725.     '*****************************************
  726.     '* temporary desabled
  727.     '*****************************************
  728.     ' save file first if dirty
  729.     'If m_DirtyNode = "" Then
  730.     '    m_DirtyNode = Node.Text
  731.     'ElseIf m_DirtyFlag.rtf = True And tvTreeView.SelectedItem.Text <> m_DirtyNode Then
  732.     '    m_Response = MsgBox("Do you wish to save: " & m_DirtyNode, vbQuestion + vbYesNo)
  733.         
  734.     '    If m_Response = vbYes Then
  735.     '        mnuFileSave_Click
  736.     '    End If
  737.         
  738.         ' clear the dirty flag regardless of user choice
  739.     '    m_DirtyFlag.rtf = False
  740.         
  741.         ' store the name of the current node for next comparison
  742.     '    m_DirtyNode = Node.Text
  743.     'End If
  744.     If Node = tvTreeView.Nodes(1).Root Then
  745.         strDash = ""
  746.         strParent = ""
  747.         strFileName = App.Path & "\Source\" & "CRPEAuto" & ".rtf"
  748.     ElseIf Node.Image = "Method" Then
  749.         strDash = "1"
  750.         strParent = Node.Parent.Text
  751.         strFileName = App.Path & "\Source\" & strDash & Node.Text & strParent & ".rtf"
  752.     ElseIf Node.Image = "Event" Then
  753.         strDash = "2"
  754.         strParent = Node.Parent.Text
  755.         strFileName = App.Path & "\Source\" & strDash & Node.Text & strParent & ".rtf"
  756.     ElseIf Node.Image = "Property" Then
  757.         strDash = "0"
  758.         strParent = Node.Parent.Text
  759.         strFileName = App.Path & "\Source\" & strDash & strParent & ".rtf"
  760.     ElseIf Node.Image = "Object" Then
  761.         strDash = "0"
  762.         strParent = ""
  763.         strFileName = App.Path & "\Source\" & strDash & Node.Text & strParent & ".rtf"
  764.     End If
  765.     rtxtCode.filename = strFileName
  766. tvTreeView_NodeClick_Exit:
  767.     m_bLoadingRTF = False
  768.     Exit Sub
  769. tvTreeView_NodeClick_Err:
  770.     If Err.Number = 75 Then ' file not found
  771.       ' create new file for this node
  772.       'lngResult = CopyFile(App.Path & "\new.rtf", strFileName, 1)
  773.       
  774.       'If Dir$(strFileName) <> "" Then
  775.         'Resume 0
  776.       'Else
  777.         ' didn't work, ignore and exit
  778.       'End If
  779.     End If
  780. End Sub
  781. Public Sub GetNodeFromIniFile()
  782. ' load treelist with object descriptors
  783. '   in Browser.ini (comma delimeted file)
  784.     On Error GoTo GetNodeFromIniFileError
  785.     Dim intFile As Integer
  786.             
  787.     ' open the object descriptor file
  788.     intFile = FreeFile
  789.     Open GetIniFilePath For Input Access Read As #intFile
  790.     ' parse each line in file, create nodes in treelist
  791.     While Not EOF(intFile)
  792.       m_bAdded = True
  793.       
  794.       ' get next line from file
  795.       Line Input #intFile, m_strTemp
  796.       
  797.       m_strTemp = Trim$(m_strTemp)
  798.      
  799.       ' if first char is apostrophe, it is a comment; don't process
  800.       If Left$(m_strTemp, 1) <> "'" Then
  801.         'add node to treeview (not from lstSortFile)
  802.         AddNodeToTreeView
  803.       Else
  804.         'line was a comment
  805.       End If
  806.     Wend
  807. GetNodeFromIniFileExit:
  808.     On Error Resume Next
  809.     Close #intFile
  810.     Exit Sub
  811. GetNodeFromIniFileError:
  812.   If Err.Number = 35602 Then
  813.     'duplicate item.. ignore (do not add)
  814.     m_bAdded = False
  815.     Resume Next
  816.   ElseIf Err.Number = 35601 Then
  817.     'item not found.. ignore (do not add)
  818.     m_bAdded = False
  819.     Resume Next
  820.   Else
  821.     MsgBox Error$
  822.   End If
  823.   GoTo GetNodeFromIniFileExit:
  824.   Resume 0
  825. End Sub
  826. Public Function GetIniFilePath() As String
  827.     GetIniFilePath = App.Path & "\" & App.Title & ".ini"
  828. End Function
  829. Private Sub togglebuttonvalue(btn As Button)
  830. ' makes normal buttons act like toggles
  831. '   useful for toolbar buttons that can be on or off
  832. '   when you don't want them to be part of a button group
  833.   On Error Resume Next
  834.   Static cButtons As Collection
  835.   Static bSet As Boolean
  836.   Dim intState As Integer
  837.   Dim intNewState As Integer
  838.   If Not bSet Then
  839.     bSet = True
  840.     Set cButtons = New Collection
  841.   End If
  842.   intState = cButtons(btn.Key)
  843.   If Err = 0 Then
  844.     'have a value
  845.   Else
  846.     'btn not in collection yet... add it
  847.     Err.Clear
  848.     intState = tbrUnpressed 'first time, it is always unpressed
  849.     cButtons.Add intState, btn.Key
  850.   End If
  851.   If Err = 0 Then
  852.     If intState = tbrPressed Then
  853.       intNewState = tbrUnpressed
  854.     Else
  855.       intNewState = tbrPressed
  856.     End If
  857.     btn.Value = intNewState
  858.     cButtons.Remove btn.Key
  859.     cButtons.Add intNewState, btn.Key
  860.   Else
  861.     'screwed up, but lets not talk about it
  862.   End If
  863. End Sub
  864. Private Sub SaveObjectList()
  865. ' write all nodes from tvTreelist to Seagate.ini
  866. '    separate node properties into comma delimited line
  867.   On Error GoTo SaveObjectList_Err:
  868.   Dim n As Node
  869.   Dim strFileName  As String
  870.   Dim strLine As String
  871.   Dim lngResult As Long
  872.   Dim hFile As Integer
  873.   ' fetch the INI file name
  874.   strFileName = App.Path & GetIniFilePath()
  875.   ' back up existing file
  876.   ' NOTE: the vb Name method actually moves the file,
  877.   '       so existing file wil not exist after this line executes
  878.   Name strFileName As strFileName & ".old"
  879.   ' create new file (see previous note on vb Name function)
  880.   hFile = FreeFile
  881.   Open strFileName For Output As #hFile
  882.   ' write each node's info to strFileName
  883.   '   each node is represented on one line
  884.   '   by comma delimited string of it's properties
  885.   For Each n In tvTreeView  'tvtreelist
  886.     ' assemble comma delimited string from node properties
  887.     strLine = n.Parent & ", " & n.Text & ", " & n.Image.Name
  888.     Write #hFile, strLine
  889.   Next n
  890.   On Error Resume Next
  891.   Close #hFile
  892. SaveObjectList_Exit:
  893.   Exit Sub
  894. SaveObjectList_Err:
  895.   MsgBox Error$
  896.   GoTo SaveObjectList_Exit:
  897.   Resume 0
  898. End Sub
  899. Public Sub AddNodeToTreeView()
  900.     On Error GoTo AddNodeToTreeViewError
  901.     Dim strGrandParent As String
  902.     Dim strParent As String
  903.     Dim strName As String
  904.     Dim strImage As String
  905.     Dim strType As String
  906.     Dim strKey As String
  907.         
  908.     ' extract GrandParent name
  909.     strGrandParent = ExtractFromList(strList:=m_strTemp, intIndex:=1, strDelimiter:=",")
  910.     ' extract Parent name
  911.     strParent = ExtractFromList(strList:=m_strTemp, intIndex:=2, strDelimiter:=",")
  912.     ' extract node name
  913.     strName = ExtractFromList(strList:=m_strTemp, intIndex:=3, strDelimiter:=",")
  914.     ' extract object type
  915.     strType = ExtractFromList(strList:=m_strTemp, intIndex:=4, strDelimiter:=",")
  916.     ' assign node icon based on object type
  917.     Select Case strType
  918.       Case TYPE_METHOD
  919.         strImage = "Method"
  920.       Case TYPE_EVENT
  921.         strImage = "Event"
  922.       Case TYPE_PROPERTY
  923.         strImage = "Property"
  924.       Case Else
  925.         'default type is object (0)
  926.         strImage = "Object"
  927.     End Select
  928.     ' Generate Key
  929.     ' Properties, events, and methods must have
  930.     ' a more detailed Key than objects.
  931.     If strImage = "Object" Then
  932.         strKey = strName & strImage & strParent
  933.     Else
  934.         strKey = strName & strImage & strParent & strGrandParent
  935.     End If
  936.         
  937.     'Can only add a node if Name is valid
  938.     If strName <> "" Then
  939.         If strParent = "" Then
  940.           ' create root node (no parent)
  941.             tvTreeView.Nodes.Add , , strKey, strName, "CRPE", "CRPE"
  942.         Else
  943.             'Attach the child node to specified parent
  944.             tvTreeView.Nodes.Add strParent & "Object" & strGrandParent, tvwChild, strKey, strName, strImage
  945.         End If
  946.     End If
  947. AddNodeToTreeViewExit:
  948.     Exit Sub
  949. AddNodeToTreeViewError:
  950.   If Err.Number = 35602 Then
  951.     'duplicate item.. ignore (do not add)
  952.     ' m_bAdded = False
  953.     Resume Next
  954.   ElseIf Err.Number = 35601 Then
  955.   ' If Err.Number = 35601 Then
  956.     'item not found.. ignore (do not add)
  957.     m_bAdded = False
  958.     Resume Next
  959.   Else
  960.     MsgBox Error$
  961.   End If
  962.   GoTo AddNodeToTreeViewExit:
  963.   Resume 0
  964. End Sub
  965.