home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Special / chip-cd_2001_spec_05.zip / spec_05 / apps / crystal / disk18 / Xvb231._ / Xvb231.
Text File  |  1999-08-23  |  35KB  |  1,126 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. End
  400. Attribute VB_Name = "frmMain"
  401. Attribute VB_GlobalNameSpace = False
  402. Attribute VB_Creatable = False
  403. Attribute VB_PredeclaredId = True
  404. Attribute VB_Exposed = False
  405. Option Explicit
  406.  
  407. Private Declare Function OSWinHelp% Lib "user32" Alias "WinHelpA" (ByVal hwnd&, ByVal HelpFile$, ByVal wCommand%, dwData As Any)
  408.  
  409. 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
  410. 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
  411.  
  412. Private m_bMoving As Boolean
  413. Private m_nodX As Node
  414.  
  415. Private m_DirtyFlag As DirtyFlag
  416. Private m_DirtyNode As String
  417. Private m_Response As Integer
  418. Private m_bLoadingRTF As Boolean
  419. Private m_strTemp As String
  420. Private m_bAdded As Boolean
  421.  
  422. Const sglSplitLimit = 500
  423.  
  424. Private Sub cmdExit_Click()
  425. '
  426. ' quit application
  427. '
  428.  
  429.     On Error Resume Next
  430.     Unload Me
  431.     
  432. End Sub
  433.  
  434. Private Sub Form_Load()
  435. '
  436. ' restore last window settings,
  437. '   load the treelist with Automation Server object names
  438. '
  439.  
  440.     Dim Index As Integer 'Node counter
  441.     
  442.     On Error GoTo Form_Load_Err:
  443.     
  444.     'retain screen settings from last session
  445.     Me.Left = GetSetting(App.Title, "Settings", "MainLeft", 1000)
  446.     Me.Top = GetSetting(App.Title, "Settings", "MainTop", 1000)
  447.     Me.Width = GetSetting(App.Title, "Settings", "MainWidth", 6500)
  448.     Me.Height = GetSetting(App.Title, "Settings", "MainHeight", 6500)
  449.     
  450.      'add Automation Server objects to TreeView
  451.     GetNodeFromIniFile
  452.    
  453.     'expand the first level by default
  454.     tvTreeView.Nodes(1).Expanded = True
  455.     
  456.     'disable label editing
  457.     tvTreeView.LabelEdit = tvwManual
  458.     'load the rtf file for the root node
  459.     rtxtCode.filename = App.Path & "\Source\CRPEAuto.rtf"
  460.     
  461. Form_Load_Exit:
  462.     Exit Sub
  463.     
  464. Form_Load_Err:
  465.     MsgBox Error$
  466.     GoTo Form_Load_Exit:
  467.     Resume 0
  468. End Sub
  469.  
  470. Private Sub Form_Unload(Cancel As Integer)
  471. '
  472. ' Save window settings, prompt to save dirty objects
  473. '
  474.  
  475.   Dim i As Integer
  476.  
  477.   ' check dirtyflags, save dirty stuff
  478.   If m_DirtyFlag.TreeView Then
  479.     If MsgBox("Save Object List?", vbInformation + vbOKCancel, "Unsaved Data Warning") = vbOK Then
  480.       SaveObjectList
  481.     End If
  482.   End If
  483.   
  484.   'close all sub forms
  485.   For i = Forms.Count - 1 To 1 Step -1
  486.       Unload Forms(i)
  487.   Next
  488.   If Me.WindowState <> vbMinimized Then
  489.       SaveSetting App.Title, "Settings", "MainLeft", Me.Left
  490.       SaveSetting App.Title, "Settings", "MainTop", Me.Top
  491.       SaveSetting App.Title, "Settings", "MainWidth", Me.Width
  492.       SaveSetting App.Title, "Settings", "MainHeight", Me.Height
  493.   End If
  494.     
  495. End Sub
  496.  
  497. Private Sub mnuFileSave_Click()
  498. '
  499. ' save the current Richtext object
  500. '
  501.  
  502.   On Error GoTo mnuFileSave_Click_Err:
  503.   MousePointer = vbHourglass
  504.   'Dim strFilename As String
  505.   'strFilename = rtxtCode.filename
  506.   rtxtCode.SaveFile rtxtCode.filename
  507.   m_DirtyFlag.rtf = False ' made it here with no error, file was saved
  508.  
  509. mnuFileSave_Click_Exit:
  510.   MousePointer = vbDefault
  511.   Exit Sub
  512. mnuFileSave_Click_Err:
  513.   MsgBox Error$
  514.   GoTo mnuFileSave_Click_Exit:
  515.   
  516. End Sub
  517.  
  518. Private Sub mnuViewBrowser_Click()
  519.     'Dim frmB As New frmBrowser
  520.     'frmB.StartingAddress = "http://elvis/aristotle/default.asp"
  521.     'frmB.Show
  522. End Sub
  523.  
  524.  
  525. Private Sub mnuFileExit_Click()
  526.     ' Unload Form
  527.     Unload Me
  528. End Sub
  529.  
  530. Private Sub mnuViewStatusBar_Click()
  531.     If mnuViewStatusBar.Checked Then
  532.         sbStatusBar.Visible = False
  533.         mnuViewStatusBar.Checked = False
  534.     Else
  535.         sbStatusBar.Visible = True
  536.         mnuViewStatusBar.Checked = True
  537.     End If
  538.     SizeControls imgSplitter.Left
  539. End Sub
  540.  
  541.  
  542. Private Sub mnuViewToolbar_Click()
  543.     If mnuViewToolbar.Checked Then
  544.         tbToolbar.Visible = False
  545.         mnuViewToolbar.Checked = False
  546.     Else
  547.         tbToolbar.Visible = True
  548.         mnuViewToolbar.Checked = True
  549.     End If
  550.     SizeControls imgSplitter.Left
  551. End Sub
  552.  
  553.  
  554. Private Sub Form_Resize()
  555.   Static bDone As Boolean
  556.   
  557.     On Error Resume Next
  558.     SizeControls imgSplitter.Left
  559. End Sub
  560.  
  561.  
  562. Private Sub imgSplitter_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  563.     With imgSplitter
  564.         rtxtCode.Move .Left, .Top, .Width \ 2, .Height - 20
  565.     End With
  566.     m_bMoving = True
  567. End Sub
  568.  
  569.  
  570. Private Sub imgSplitter_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  571.     Dim sglPos As Single
  572.  
  573.     If m_bMoving Then
  574.         sglPos = x + imgSplitter.Left
  575.         If sglPos < sglSplitLimit Then
  576.             rtxtCode.Left = sglSplitLimit
  577.         ElseIf sglPos > Me.Width - sglSplitLimit Then
  578.             rtxtCode.Left = Me.Width - sglSplitLimit
  579.         Else
  580.             rtxtCode.Left = sglPos
  581.         End If
  582.     End If
  583.     
  584. End Sub
  585.  
  586.  
  587. Private Sub imgSplitter_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  588.     SizeControls rtxtCode.Left
  589.     rtxtCode.Visible = True
  590.     m_bMoving = False
  591. End Sub
  592.  
  593.  
  594. Sub SizeControls(x As Single)
  595.     On Error Resume Next
  596.     Dim intHeight As Integer
  597.     
  598.     'set the width
  599.     If x < 1500 Then x = 1500
  600.     If x > (Me.Width - 1500) Then x = Me.Width - 1500
  601.     tvTreeView.Width = x
  602.     imgSplitter.Left = x
  603.     rtxtCode.Left = x + 40
  604.     rtxtCode.Width = Me.Width - (tvTreeView.Width + 140)
  605.     lblTitle(0).Width = tvTreeView.Width
  606.     lblTitle(1).Left = rtxtCode.Left + 20
  607.     lblTitle(1).Width = rtxtCode.Width - 40
  608.  
  609.     'set the top
  610.     If tbToolbar.Visible Then
  611.         tvTreeView.Top = tbToolbar.Height + picTitles.Height
  612.     Else
  613.         tvTreeView.Top = picTitles.Height
  614.     End If
  615.     
  616.     rtxtCode.Top = tvTreeView.Top
  617.     
  618.     If sbStatusBar.Visible Then
  619.         If tbToolbar.Visible Then
  620.             'take off the status bar height if it is not visible
  621.             intHeight = Me.ScaleHeight - (picTitles.Height + sbStatusBar.Height + tbToolbar.Height)
  622.         Else
  623.             intHeight = Me.ScaleHeight - (picTitles.Height + sbStatusBar.Height)
  624.         End If
  625.     Else
  626.         If tbToolbar.Visible Then
  627.             intHeight = Me.ScaleHeight - (picTitles.Height + tbToolbar.Height)
  628.         Else
  629.             intHeight = Me.ScaleHeight - picTitles.Height
  630.         End If
  631.     End If
  632.  
  633.     tvTreeView.Height = intHeight
  634.     rtxtCode.Height = intHeight
  635.     imgSplitter.Top = tvTreeView.Top
  636.     imgSplitter.Height = intHeight
  637.     
  638. End Sub
  639.  
  640.  
  641. Private Sub rtxtCode_Change()
  642.     If Not m_bLoadingRTF Then
  643.         m_DirtyFlag.rtf = True
  644.     End If
  645. End Sub
  646.  
  647.  
  648. Private Sub tbToolBar_ButtonClick(ByVal Button As ComctlLib.Button)
  649.  
  650.     Select Case Button.Key
  651.         Case "Back"
  652.             If Not tvTreeView.SelectedItem.Parent Is Nothing Then
  653.                 tvTreeView.SelectedItem = tvTreeView.SelectedItem.Parent
  654.             End If
  655.         Case "Forward"
  656.             If Not tvTreeView.SelectedItem.Child Is Nothing Then
  657.                 tvTreeView.SelectedItem = tvTreeView.SelectedItem.Child
  658.             End If
  659.         Case "Cut"
  660.             'mnuEditCut_Click
  661.         Case "Copy"
  662.             mnuEditCopy_Click
  663.         Case "Paste"
  664.             'mnuEditPaste_Click
  665.         Case "Delete"
  666.             'mnuFileDelete_Click
  667.         Case "Properties"
  668.             'mnuFileProperties_Click
  669.         Case "Save"
  670.             'rtxtCode.SaveFile App.Path & "\" & tvTreeView.SelectedItem.Text & ".rtf"
  671.             'mnuFileSave_Click
  672.         Case "bold"
  673.           'togglebuttonvalue Button
  674.           'rtxtCode.SelBold = (Button.Value = tbrPressed)
  675.         Case "italic"
  676.           'togglebuttonvalue Button
  677.           'rtxtCode.SelItalic = (Button.Value = tbrPressed)
  678.         Case "underline"
  679.           'togglebuttonvalue Button
  680.           'rtxtCode.SelUnderline = (Button.Value = tbrPressed)
  681.     End Select
  682. End Sub
  683.  
  684.  
  685. Private Sub mnuHelpContents_Click()
  686.     
  687.  
  688.     Dim nRet As Integer
  689.  
  690.  
  691.     'if there is no helpfile for this project display a message to the user
  692.     'you can set the HelpFile for your application in the
  693.     'Project Properties dialog
  694.     If Len(App.HelpFile) = 0 Then
  695.         MsgBox "Unable to display Help Contents. There is no Help associated with this project.", vbInformation, Me.Caption
  696.     Else
  697.         On Error Resume Next
  698.         nRet = OSWinHelp(Me.hwnd, App.HelpFile, 3, 0)
  699.         If Err Then
  700.             MsgBox Err.Description
  701.         End If
  702.     End If
  703. End Sub
  704.  
  705.  
  706. Private Sub mnuHelpSearch_Click()
  707.     
  708.  
  709.     Dim nRet As Integer
  710.  
  711.  
  712.     'if there is no helpfile for this project display a message to the user
  713.     'you can set the HelpFile for your application in the
  714.     'Project Properties dialog
  715.     If Len(App.HelpFile) = 0 Then
  716.         MsgBox "Unable to display Help Contents. There is no Help associated with this project.", vbInformation, Me.Caption
  717.     Else
  718.         On Error Resume Next
  719.         nRet = OSWinHelp(Me.hwnd, App.HelpFile, 261, 0)
  720.         If Err Then
  721.             MsgBox Err.Description
  722.         End If
  723.     End If
  724. End Sub
  725.  
  726. Private Sub mnuViewRefresh_Click()
  727.     'To Do
  728.     'MsgBox "Refresh Code goes here!"
  729. End Sub
  730.  
  731. Private Sub mnuEditCopy_Click()
  732.     Clipboard.Clear
  733.     Clipboard.SetText rtxtCode.SelText, vbCFText
  734. End Sub
  735.  
  736.  
  737. Private Sub mnuEditCut_Click()
  738.     'To Do
  739.     'MsgBox "Cut Code goes here!"
  740. End Sub
  741.  
  742.  
  743. Private Sub mnuEditDSelectAll_Click()
  744.     'To Do
  745.     'MsgBox "Select All Code goes here!"
  746. End Sub
  747.  
  748.  
  749. Private Sub mnuEditInvertSelection_Click()
  750.     'To Do
  751.     'MsgBox "Invert Selection Code goes here!"
  752. End Sub
  753.  
  754.  
  755. Private Sub mnuEditPaste_Click()
  756.     'To Do
  757.     'MsgBox "Paste Code goes here!"
  758. End Sub
  759.  
  760.  
  761. Private Sub mnuEditPasteSpecial_Click()
  762.     'To Do
  763.     'MsgBox "Paste Special Code goes here!"
  764. End Sub
  765.  
  766.  
  767. Private Sub mnuEditUndo_Click()
  768.     'To Do
  769.     'MsgBox "Undo Code goes here!"
  770. End Sub
  771.  
  772.  
  773. Private Sub mnuFileOpen_Click()
  774.     'To Do
  775.     'MsgBox "Open Code goes here!"
  776. End Sub
  777.  
  778.  
  779. Private Sub mnuFileFind_Click()
  780.     'To Do
  781.     'MsgBox "Find Code goes here!"
  782. End Sub
  783.  
  784.  
  785. Private Sub mnuFileSendTo_Click()
  786.     'To Do
  787.     'MsgBox "Send To Code goes here!"
  788. End Sub
  789.  
  790.  
  791. Private Sub mnuFileNew_Click()
  792.     'To Do
  793.     'MsgBox "New File Code goes here!"
  794. End Sub
  795.  
  796.  
  797. Private Sub mnuFileDelete_Click()
  798.     'To Do
  799.     'MsgBox "Delete Code goes here!"
  800. End Sub
  801.  
  802.  
  803. Private Sub mnuFileRename_Click()
  804.     'To Do
  805.     'MsgBox "Rename Code goes here!"
  806. End Sub
  807.  
  808.  
  809. Private Sub mnuFileProperties_Click()
  810.     'To Do
  811.     'MsgBox "Properties Code goes here!"
  812. End Sub
  813.  
  814.  
  815. Private Sub mnuFileMRU_Click(Index As Integer)
  816.     'To Do
  817.     'MsgBox "MRU Code goes here!"
  818. End Sub
  819.  
  820. Private Sub tvTreeView_NodeClick(ByVal Node As ComctlLib.Node)
  821. '
  822. '   Display sample code for the selected node
  823. '
  824.   
  825.     On Error GoTo tvTreeView_NodeClick_Err:
  826.     Dim lngResult As Long
  827.     Dim strFileName As String
  828.     Dim strDash As String
  829.     Dim strParent As String
  830.     
  831.     '*****************************************
  832.     '* temporary desabled
  833.     '*****************************************
  834.     ' tell Change event not to set dirty flag
  835.     'm_bLoadingRTF = True
  836.     
  837.     Node.Selected = True
  838.     
  839.     '*****************************************
  840.     '* temporary desabled
  841.     '*****************************************
  842.     ' save file first if dirty
  843.     'If m_DirtyNode = "" Then
  844.     '    m_DirtyNode = Node.Text
  845.     'ElseIf m_DirtyFlag.rtf = True And tvTreeView.SelectedItem.Text <> m_DirtyNode Then
  846.     '    m_Response = MsgBox("Do you wish to save: " & m_DirtyNode, vbQuestion + vbYesNo)
  847.         
  848.     '    If m_Response = vbYes Then
  849.     '        mnuFileSave_Click
  850.     '    End If
  851.         
  852.         ' clear the dirty flag regardless of user choice
  853.     '    m_DirtyFlag.rtf = False
  854.         
  855.         ' store the name of the current node for next comparison
  856.     '    m_DirtyNode = Node.Text
  857.     'End If
  858.     
  859.     If Node = tvTreeView.Nodes(1).Root Then
  860.         strDash = ""
  861.         strParent = ""
  862.         strFileName = App.Path & "\Source\" & "CRPEAuto" & ".rtf"
  863.     ElseIf Node.Image = "Method" Then
  864.         strDash = "1"
  865.         strParent = Node.Parent.Text
  866.         strFileName = App.Path & "\Source\" & strDash & Node.Text & strParent & ".rtf"
  867.     ElseIf Node.Image = "Event" Then
  868.         strDash = "2"
  869.         strParent = Node.Parent.Text
  870.         strFileName = App.Path & "\Source\" & strDash & Node.Text & strParent & ".rtf"
  871.     ElseIf Node.Image = "Property" Then
  872.         strDash = "0"
  873.         strParent = Node.Parent.Text
  874.         strFileName = App.Path & "\Source\" & strDash & strParent & ".rtf"
  875.     ElseIf Node.Image = "Object" Then
  876.         strDash = "0"
  877.         strParent = ""
  878.         strFileName = App.Path & "\Source\" & strDash & Node.Text & strParent & ".rtf"
  879.     End If
  880.     
  881.     rtxtCode.filename = strFileName
  882.     
  883. tvTreeView_NodeClick_Exit:
  884.     m_bLoadingRTF = False
  885.     Exit Sub
  886.     
  887. tvTreeView_NodeClick_Err:
  888.     If Err.Number = 75 Then ' file not found
  889.       ' create new file for this node
  890.       'lngResult = CopyFile(App.Path & "\new.rtf", strFileName, 1)
  891.       
  892.       'If Dir$(strFileName) <> "" Then
  893.         'Resume 0
  894.       'Else
  895.         ' didn't work, ignore and exit
  896.       'End If
  897.     End If
  898.     
  899. End Sub
  900.  
  901. Public Sub GetNodeFromIniFile()
  902. '
  903. ' load treelist with object descriptors
  904. '   in Browser.ini (comma delimeted file)
  905. '
  906. '
  907.  
  908.     On Error GoTo GetNodeFromIniFileError
  909.     Dim intFile As Integer
  910.             
  911.     ' open the object descriptor file
  912.     intFile = FreeFile
  913.     Open GetIniFilePath For Input Access Read As #intFile
  914.     
  915.     ' parse each line in file, create nodes in treelist
  916.     While Not EOF(intFile)
  917.       m_bAdded = True
  918.       
  919.       ' get next line from file
  920.       Line Input #intFile, m_strTemp
  921.       
  922.       m_strTemp = Trim$(m_strTemp)
  923.      
  924.       ' if first char is apostrophe, it is a comment; don't process
  925.       If Left$(m_strTemp, 1) <> "'" Then
  926.         'add node to treeview (not from lstSortFile)
  927.         AddNodeToTreeView
  928.       Else
  929.         'line was a comment
  930.       End If
  931.     Wend
  932.     
  933. GetNodeFromIniFileExit:
  934.     On Error Resume Next
  935.     Close #intFile
  936.     Exit Sub
  937. GetNodeFromIniFileError:
  938.   If Err.Number = 35602 Then
  939.     'duplicate item.. ignore (do not add)
  940.     m_bAdded = False
  941.     Resume Next
  942.   ElseIf Err.Number = 35601 Then
  943.     'item not found.. ignore (do not add)
  944.     m_bAdded = False
  945.     Resume Next
  946.   Else
  947.     MsgBox Error$
  948.   End If
  949.   
  950.   GoTo GetNodeFromIniFileExit:
  951.   Resume 0
  952.  
  953. End Sub
  954.  
  955. Public Function GetIniFilePath() As String
  956.     GetIniFilePath = App.Path & "\" & App.Title & ".ini"
  957. End Function
  958.  
  959.  
  960. Private Sub togglebuttonvalue(btn As Button)
  961. '
  962. ' makes normal buttons act like toggles
  963. '   useful for toolbar buttons that can be on or off
  964. '   when you don't want them to be part of a button group
  965. '
  966.  
  967.   On Error Resume Next
  968.   
  969.   Static cButtons As Collection
  970.   Static bSet As Boolean
  971.   
  972.   Dim intState As Integer
  973.   Dim intNewState As Integer
  974.   
  975.   If Not bSet Then
  976.     bSet = True
  977.     Set cButtons = New Collection
  978.   End If
  979.   
  980.   intState = cButtons(btn.Key)
  981.   If Err = 0 Then
  982.     'have a value
  983.   Else
  984.     'btn not in collection yet... add it
  985.     Err.Clear
  986.     intState = tbrUnpressed 'first time, it is always unpressed
  987.     cButtons.Add intState, btn.Key
  988.   End If
  989.   If Err = 0 Then
  990.     If intState = tbrPressed Then
  991.       intNewState = tbrUnpressed
  992.     Else
  993.       intNewState = tbrPressed
  994.     End If
  995.     btn.Value = intNewState
  996.     cButtons.Remove btn.Key
  997.     cButtons.Add intNewState, btn.Key
  998.   Else
  999.     'screwed up, but lets not talk about it
  1000.   End If
  1001.  
  1002. End Sub
  1003.  
  1004. Private Sub SaveObjectList()
  1005. '
  1006. ' write all nodes from tvTreelist to Seagate.ini
  1007. '    separate node properties into comma delimited line
  1008. '
  1009.  
  1010.   On Error GoTo SaveObjectList_Err:
  1011.   
  1012.   Dim n As Node
  1013.   Dim strFileName  As String
  1014.   Dim strLine As String
  1015.   Dim lngResult As Long
  1016.   Dim hFile As Integer
  1017.     
  1018.   ' fetch the INI file name
  1019.   strFileName = App.Path & GetIniFilePath()
  1020.   
  1021.   ' back up existing file
  1022.   ' NOTE: the vb Name method actually moves the file,
  1023.   '       so existing file wil not exist after this line executes
  1024.   Name strFileName As strFileName & ".old"
  1025.   
  1026.   ' create new file (see previous note on vb Name function)
  1027.   hFile = FreeFile
  1028.   Open strFileName For Output As #hFile
  1029.   
  1030.   ' write each node's info to strFileName
  1031.   '   each node is represented on one line
  1032.   '   by comma delimited string of it's properties
  1033.   For Each n In tvTreeView  'tvtreelist
  1034.     ' assemble comma delimited string from node properties
  1035.     strLine = n.Parent & ", " & n.Text & ", " & n.Image.Name
  1036.     Write #hFile, strLine
  1037.   Next n
  1038.   
  1039.   On Error Resume Next
  1040.   Close #hFile
  1041.     
  1042. SaveObjectList_Exit:
  1043.   Exit Sub
  1044. SaveObjectList_Err:
  1045.   MsgBox Error$
  1046.   GoTo SaveObjectList_Exit:
  1047.   Resume 0
  1048.   
  1049. End Sub
  1050.  
  1051. Public Sub AddNodeToTreeView()
  1052.     
  1053.     On Error GoTo AddNodeToTreeViewError
  1054.     Dim strGrandParent As String
  1055.     Dim strParent As String
  1056.     Dim strName As String
  1057.     Dim strImage As String
  1058.     Dim strType As String
  1059.     Dim strKey As String
  1060.         
  1061.     ' extract GrandParent name
  1062.     strGrandParent = ExtractFromList(strList:=m_strTemp, intIndex:=1, strDelimiter:=",")
  1063.     
  1064.     ' extract Parent name
  1065.     strParent = ExtractFromList(strList:=m_strTemp, intIndex:=2, strDelimiter:=",")
  1066.     
  1067.     ' extract node name
  1068.     strName = ExtractFromList(strList:=m_strTemp, intIndex:=3, strDelimiter:=",")
  1069.     
  1070.     ' extract object type
  1071.     strType = ExtractFromList(strList:=m_strTemp, intIndex:=4, strDelimiter:=",")
  1072.     
  1073.     ' assign node icon based on object type
  1074.     Select Case strType
  1075.       Case TYPE_METHOD
  1076.         strImage = "Method"
  1077.       Case TYPE_EVENT
  1078.         strImage = "Event"
  1079.       Case TYPE_PROPERTY
  1080.         strImage = "Property"
  1081.       Case Else
  1082.         'default type is object (0)
  1083.         strImage = "Object"
  1084.     End Select
  1085.  
  1086.     ' Generate Key
  1087.     ' Properties, events, and methods must have
  1088.     ' a more detailed Key than objects.
  1089.     If strImage = "Object" Then
  1090.         strKey = strName & strImage & strParent
  1091.     Else
  1092.         strKey = strName & strImage & strParent & strGrandParent
  1093.     End If
  1094.         
  1095.     'Can only add a node if Name is valid
  1096.     If strName <> "" Then
  1097.         If strParent = "" Then
  1098.           ' create root node (no parent)
  1099.             tvTreeView.Nodes.Add , , strKey, strName, "CRPE", "CRPE"
  1100.         Else
  1101.             'Attach the child node to specified parent
  1102.             tvTreeView.Nodes.Add strParent & "Object" & strGrandParent, tvwChild, strKey, strName, strImage
  1103.         End If
  1104.     End If
  1105.  
  1106. AddNodeToTreeViewExit:
  1107.     Exit Sub
  1108. AddNodeToTreeViewError:
  1109.   If Err.Number = 35602 Then
  1110.     'duplicate item.. ignore (do not add)
  1111.     ' m_bAdded = False
  1112.     Resume Next
  1113.   ElseIf Err.Number = 35601 Then
  1114.   ' If Err.Number = 35601 Then
  1115.     'item not found.. ignore (do not add)
  1116.     m_bAdded = False
  1117.     Resume Next
  1118.   Else
  1119.     MsgBox Error$
  1120.   End If
  1121.   
  1122.   GoTo AddNodeToTreeViewExit:
  1123.   Resume 0
  1124.   
  1125. End Sub
  1126.