home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / himetr1r / ctldata.ctl (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-08-15  |  44.7 KB  |  1,219 lines

  1. VERSION 5.00
  2. Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
  3. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
  4. Begin VB.UserControl ctlData 
  5.    ClientHeight    =   2700
  6.    ClientLeft      =   0
  7.    ClientTop       =   0
  8.    ClientWidth     =   3675
  9.    BeginProperty Font 
  10.       Name            =   "Tahoma"
  11.       Size            =   8.25
  12.       Charset         =   0
  13.       Weight          =   400
  14.       Underline       =   0   'False
  15.       Italic          =   0   'False
  16.       Strikethrough   =   0   'False
  17.    EndProperty
  18.    ScaleHeight     =   2700
  19.    ScaleWidth      =   3675
  20.    Begin VB.PictureBox picTabContainer 
  21.       BackColor       =   &H80000005&
  22.       Height          =   2415
  23.       Index           =   4
  24.       Left            =   360
  25.       ScaleHeight     =   2355
  26.       ScaleWidth      =   5835
  27.       TabIndex        =   5
  28.       Top             =   2880
  29.       Width           =   5895
  30.       Begin VB.Label lblDBVer 
  31.          AutoSize        =   -1  'True
  32.          BackStyle       =   0  'Transparent
  33.          Caption         =   "DB Version:"
  34.          ForeColor       =   &H000080FF&
  35.          Height          =   195
  36.          Left            =   720
  37.          TabIndex        =   17
  38.          Top             =   1800
  39.          Width           =   825
  40.       End
  41.       Begin VB.Label lblItems 
  42.          AutoSize        =   -1  'True
  43.          BackStyle       =   0  'Transparent
  44.          Caption         =   "Number Of Code Items: "
  45.          ForeColor       =   &H000080FF&
  46.          Height          =   195
  47.          Left            =   720
  48.          TabIndex        =   16
  49.          Top             =   1560
  50.          Width           =   1755
  51.       End
  52.       Begin VB.Shape shpBorder 
  53.          BorderStyle     =   0  'Transparent
  54.          FillColor       =   &H00C0E0FF&
  55.          FillStyle       =   0  'Solid
  56.          Height          =   1815
  57.          Left            =   0
  58.          Top             =   525
  59.          Width           =   375
  60.       End
  61.       Begin VB.Label lblFeatures 
  62.          AutoSize        =   -1  'True
  63.          BackStyle       =   0  'Transparent
  64.          Caption         =   "Features found in the Develpers Code Book"
  65.          DragIcon        =   "ctlData.ctx":0000
  66.          ForeColor       =   &H000080FF&
  67.          Height          =   195
  68.          Left            =   720
  69.          TabIndex        =   14
  70.          Top             =   1080
  71.          Width           =   3135
  72.       End
  73.       Begin VB.Label lblAbout 
  74.          AutoSize        =   -1  'True
  75.          BackStyle       =   0  'Transparent
  76.          Caption         =   "About the Developers Code Book"
  77.          DragIcon        =   "ctlData.ctx":030A
  78.          ForeColor       =   &H000080FF&
  79.          Height          =   195
  80.          Left            =   720
  81.          TabIndex        =   13
  82.          Top             =   1320
  83.          Width           =   2385
  84.       End
  85.       Begin VB.Label lblUrl 
  86.          AutoSize        =   -1  'True
  87.          BackColor       =   &H00C0E0FF&
  88.          BackStyle       =   0  'Transparent
  89.          Caption         =   "http://www.vbsquare.com/dev/"
  90.          DragIcon        =   "ctlData.ctx":0614
  91.          BeginProperty Font 
  92.             Name            =   "Tahoma"
  93.             Size            =   8.25
  94.             Charset         =   0
  95.             Weight          =   400
  96.             Underline       =   -1  'True
  97.             Italic          =   0   'False
  98.             Strikethrough   =   0   'False
  99.          EndProperty
  100.          ForeColor       =   &H000080FF&
  101.          Height          =   195
  102.          Left            =   1440
  103.          TabIndex        =   12
  104.          Top             =   600
  105.          Width           =   2820
  106.       End
  107.       Begin VB.Label lblTitle 
  108.          AutoSize        =   -1  'True
  109.          BackColor       =   &H000080FF&
  110.          Caption         =   "Developers Code Book"
  111.          BeginProperty Font 
  112.             Name            =   "Tahoma"
  113.             Size            =   21.75
  114.             Charset         =   0
  115.             Weight          =   400
  116.             Underline       =   0   'False
  117.             Italic          =   0   'False
  118.             Strikethrough   =   0   'False
  119.          EndProperty
  120.          Height          =   525
  121.          Left            =   0
  122.          TabIndex        =   11
  123.          Top             =   0
  124.          Width           =   4410
  125.       End
  126.    End
  127.    Begin VB.PictureBox picTabContainer 
  128.       Height          =   1575
  129.       Index           =   5
  130.       Left            =   1440
  131.       ScaleHeight     =   1515
  132.       ScaleWidth      =   3435
  133.       TabIndex        =   7
  134.       Top             =   3720
  135.       Width           =   3495
  136.       Begin ComctlLib.ListView lvDetails 
  137.          Height          =   975
  138.          Left            =   120
  139.          TabIndex        =   8
  140.          Top             =   0
  141.          Width           =   3015
  142.          _ExtentX        =   5318
  143.          _ExtentY        =   1720
  144.          View            =   3
  145.          LabelEdit       =   1
  146.          LabelWrap       =   -1  'True
  147.          HideSelection   =   0   'False
  148.          _Version        =   327682
  149.          ForeColor       =   -2147483640
  150.          BackColor       =   -2147483643
  151.          BorderStyle     =   1
  152.          Appearance      =   1
  153.          NumItems        =   2
  154.          BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  155.             Key             =   ""
  156.             Object.Tag             =   ""
  157.             Text            =   "Description"
  158.             Object.Width           =   2540
  159.          EndProperty
  160.          BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  161.             SubItemIndex    =   1
  162.             Key             =   ""
  163.             Object.Tag             =   ""
  164.             Text            =   "Content"
  165.             Object.Width           =   2540
  166.          EndProperty
  167.       End
  168.    End
  169.    Begin VB.PictureBox picTabContainer 
  170.       Height          =   1575
  171.       Index           =   2
  172.       Left            =   1080
  173.       ScaleHeight     =   1515
  174.       ScaleWidth      =   3315
  175.       TabIndex        =   2
  176.       Top             =   3480
  177.       Width           =   3375
  178.       Begin prjDevBook.ctlColour rtfExample 
  179.          Height          =   1215
  180.          Left            =   0
  181.          TabIndex        =   10
  182.          Top             =   0
  183.          Width           =   2895
  184.          _ExtentX        =   5106
  185.          _ExtentY        =   2143
  186.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  187.             Name            =   "Courier New"
  188.             Size            =   9
  189.             Charset         =   0
  190.             Weight          =   400
  191.             Underline       =   0   'False
  192.             Italic          =   0   'False
  193.             Strikethrough   =   0   'False
  194.          EndProperty
  195.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  196.             Name            =   "Courier New"
  197.             Size            =   9
  198.             Charset         =   0
  199.             Weight          =   400
  200.             Underline       =   0   'False
  201.             Italic          =   0   'False
  202.             Strikethrough   =   0   'False
  203.          EndProperty
  204.          BackColor       =   -2147483643
  205.          BorderStyle     =   1
  206.          MouseIcon       =   "ctlData.ctx":091E
  207.          OLEDropMode     =   2
  208.          ScrollBars      =   3
  209.          ColourComment   =   32768
  210.          ColourKeyword   =   8388608
  211.          TextRTF         =   $"ctlData.ctx":093A
  212.          Object.TabStop         =   -1  'True
  213.       End
  214.    End
  215.    Begin VB.PictureBox picTabContainer 
  216.       Height          =   1575
  217.       Index           =   3
  218.       Left            =   840
  219.       ScaleHeight     =   1515
  220.       ScaleWidth      =   3435
  221.       TabIndex        =   3
  222.       Top             =   3240
  223.       Width           =   3495
  224.       Begin RichTextLib.RichTextBox rtfNotes 
  225.          Height          =   1095
  226.          Left            =   0
  227.          TabIndex        =   4
  228.          Top             =   0
  229.          Width           =   2895
  230.          _ExtentX        =   5106
  231.          _ExtentY        =   1931
  232.          _Version        =   393217
  233.          ScrollBars      =   3
  234.          TextRTF         =   $"ctlData.ctx":0A46
  235.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  236.             Name            =   "Verdana"
  237.             Size            =   9.75
  238.             Charset         =   0
  239.             Weight          =   400
  240.             Underline       =   0   'False
  241.             Italic          =   0   'False
  242.             Strikethrough   =   0   'False
  243.          EndProperty
  244.       End
  245.    End
  246.    Begin VB.PictureBox picTabContainer 
  247.       Height          =   1455
  248.       Index           =   1
  249.       Left            =   600
  250.       ScaleHeight     =   1395
  251.       ScaleWidth      =   3075
  252.       TabIndex        =   1
  253.       Top             =   3000
  254.       Width           =   3135
  255.       Begin prjDevBook.ctlColour rtfCode 
  256.          Height          =   1215
  257.          Left            =   0
  258.          TabIndex        =   9
  259.          Top             =   0
  260.          Width           =   2895
  261.          _ExtentX        =   5106
  262.          _ExtentY        =   2143
  263.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  264.             Name            =   "Courier New"
  265.             Size            =   9.75
  266.             Charset         =   0
  267.             Weight          =   400
  268.             Underline       =   0   'False
  269.             Italic          =   0   'False
  270.             Strikethrough   =   0   'False
  271.          EndProperty
  272.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  273.             Name            =   "Courier New"
  274.             Size            =   9.75
  275.             Charset         =   0
  276.             Weight          =   400
  277.             Underline       =   0   'False
  278.             Italic          =   0   'False
  279.             Strikethrough   =   0   'False
  280.          EndProperty
  281.          BackColor       =   -2147483643
  282.          BorderStyle     =   1
  283.          MouseIcon       =   "ctlData.ctx":0B52
  284.          OLEDropMode     =   2
  285.          ScrollBars      =   3
  286.          ColourComment   =   32768
  287.          ColourKeyword   =   8388608
  288.          TextRTF         =   $"ctlData.ctx":0B6E
  289.          Object.TabStop         =   -1  'True
  290.       End
  291.    End
  292.    Begin RichTextLib.RichTextBox txtTemp 
  293.       Height          =   615
  294.       Left            =   3720
  295.       TabIndex        =   6
  296.       Top             =   480
  297.       Visible         =   0   'False
  298.       Width           =   855
  299.       _ExtentX        =   1508
  300.       _ExtentY        =   1085
  301.       _Version        =   393217
  302.       Enabled         =   -1  'True
  303.       HideSelection   =   0   'False
  304.       TextRTF         =   $"ctlData.ctx":0C7A
  305.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  306.          Name            =   "Courier New"
  307.          Size            =   9
  308.          Charset         =   0
  309.          Weight          =   400
  310.          Underline       =   0   'False
  311.          Italic          =   0   'False
  312.          Strikethrough   =   0   'False
  313.       EndProperty
  314.    End
  315.    Begin ComctlLib.TabStrip tbsTab 
  316.       Height          =   2655
  317.       Left            =   0
  318.       TabIndex        =   0
  319.       Top             =   0
  320.       Width           =   3615
  321.       _ExtentX        =   6376
  322.       _ExtentY        =   4683
  323.       ImageList       =   "imgIcons"
  324.       _Version        =   327682
  325.       BeginProperty Tabs {0713E432-850A-101B-AFC0-4210102A8DA7} 
  326.          NumTabs         =   5
  327.          BeginProperty Tab1 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  328.             Caption         =   "Code"
  329.             Key             =   ""
  330.             Object.Tag             =   ""
  331.             Object.ToolTipText     =   "Code"
  332.             ImageVarType    =   8
  333.             ImageKey        =   "EDIT"
  334.          EndProperty
  335.          BeginProperty Tab2 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  336.             Caption         =   "Example"
  337.             Key             =   ""
  338.             Object.Tag             =   ""
  339.             Object.ToolTipText     =   "Example"
  340.             ImageVarType    =   8
  341.             ImageKey        =   "EXAMPLE"
  342.          EndProperty
  343.          BeginProperty Tab3 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  344.             Caption         =   "Notes"
  345.             Key             =   ""
  346.             Object.Tag             =   ""
  347.             Object.ToolTipText     =   "Notes"
  348.             ImageVarType    =   8
  349.             ImageKey        =   "NOTES"
  350.          EndProperty
  351.          BeginProperty Tab4 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  352.             Caption         =   "Help"
  353.             Key             =   ""
  354.             Object.Tag             =   ""
  355.             Object.ToolTipText     =   "Help"
  356.             ImageVarType    =   8
  357.             ImageKey        =   "HELP"
  358.          EndProperty
  359.          BeginProperty Tab5 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  360.             Caption         =   "Details"
  361.             Key             =   ""
  362.             Object.Tag             =   ""
  363.             Object.ToolTipText     =   "Details"
  364.             ImageVarType    =   8
  365.             ImageKey        =   "PROPS"
  366.          EndProperty
  367.       EndProperty
  368.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  369.          Name            =   "Tahoma"
  370.          Size            =   8.25
  371.          Charset         =   0
  372.          Weight          =   400
  373.          Underline       =   0   'False
  374.          Italic          =   0   'False
  375.          Strikethrough   =   0   'False
  376.       EndProperty
  377.    End
  378.    Begin ComctlLib.ImageList imgIcons 
  379.       Left            =   4080
  380.       Top             =   2040
  381.       _ExtentX        =   1005
  382.       _ExtentY        =   1005
  383.       BackColor       =   -2147483633
  384.       ImageWidth      =   16
  385.       ImageHeight     =   16
  386.       MaskColor       =   12632256
  387.       _Version        =   327682
  388.       BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
  389.          NumListImages   =   5
  390.          BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  391.             Picture         =   "ctlData.ctx":0D86
  392.             Key             =   "NOTES"
  393.          EndProperty
  394.          BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  395.             Picture         =   "ctlData.ctx":10A0
  396.             Key             =   "EXAMPLE"
  397.          EndProperty
  398.          BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  399.             Picture         =   "ctlData.ctx":13BA
  400.             Key             =   "HELP"
  401.          EndProperty
  402.          BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  403.             Picture         =   "ctlData.ctx":16D4
  404.             Key             =   "EDIT"
  405.          EndProperty
  406.          BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  407.             Picture         =   "ctlData.ctx":19EE
  408.             Key             =   "PROPS"
  409.          EndProperty
  410.       EndProperty
  411.    End
  412.    Begin VB.Label lblCaption 
  413.       BackColor       =   &H8000000C&
  414.       Caption         =   "Developers Code Book"
  415.       BeginProperty Font 
  416.          Name            =   "Tahoma"
  417.          Size            =   14.25
  418.          Charset         =   0
  419.          Weight          =   700
  420.          Underline       =   0   'False
  421.          Italic          =   0   'False
  422.          Strikethrough   =   0   'False
  423.       EndProperty
  424.       ForeColor       =   &H00FFFFFF&
  425.       Height          =   375
  426.       Left            =   1560
  427.       TabIndex        =   15
  428.       Top             =   5640
  429.       Width           =   3735
  430.    End
  431. Attribute VB_Name = "ctlData"
  432. Attribute VB_GlobalNameSpace = False
  433. Attribute VB_Creatable = True
  434. Attribute VB_PredeclaredId = False
  435. Attribute VB_Exposed = False
  436. '----------------------------------------
  437. '- Name: Sam Huggill
  438. '- Email: sam@vbsquare.com
  439. '- Web: http://www.vbsquare.com/
  440. '- Company: Lighthouse Internet Solutions
  441. '- Date/Time: 14/08/99 11:27:24
  442. '----------------------------------------
  443. '- Notes:   Data control for the program.
  444. '           Interface between the tree and
  445. '           the data module
  446. '----------------------------------------
  447. Option Explicit
  448. Private Const NumberOfTabs = 5
  449. Private Const m_def_Enabled = 0
  450. Private blnChanged As Boolean
  451. Dim m_Enabled As Boolean
  452. 'Default Property Values:
  453. Const m_def_Text = ""
  454. Const m_def_Code = "0"
  455. Const m_def_Example = "0"
  456. Const m_def_Notes = ""
  457. Const m_def_Caption = "0"
  458. 'Property Variables:
  459. Dim m_Text As String
  460. Dim m_Code As String
  461. Dim m_Example As String
  462. Dim m_Notes As String
  463. Dim m_Caption As String
  464. Private m_lngClr As Long
  465. Private sngListViewX As Single
  466. Private sngListViewY As Single
  467. Private WithEvents m_cMenu As cPopupMenu
  468. Attribute m_cMenu.VB_VarHelpID = -1
  469. Private WithEvents m_cDetails As cPopupMenu
  470. Attribute m_cDetails.VB_VarHelpID = -1
  471. Public Property Get Text() As String
  472.     Text = rtfCode.Text
  473. End Property
  474. Public Property Get Code() As String
  475.     Code = rtfCode.TextRTF
  476. End Property
  477. Public Property Let Code(ByVal New_Code As String)
  478.     rtfCode.TextRTF = New_Code
  479.     PropertyChanged "Code"
  480. End Property
  481. Public Property Get Example() As String
  482.     Example = rtfExample.TextRTF
  483. End Property
  484. Public Property Let Example(ByVal New_Example As String)
  485.     rtfExample.TextRTF = New_Example
  486.     PropertyChanged "Example"
  487. End Property
  488. Public Property Get Notes() As String
  489.     Notes = rtfNotes.TextRTF
  490. End Property
  491. Public Property Let Notes(ByVal New_Notes As String)
  492.     rtfNotes.TextRTF = New_Notes
  493.     '    rtfNotes.SelStart = 0
  494.     '    rtfNotes.SelLength = Len(rtfNotes.Text)
  495.     '    rtfNotes.SelFontSize = "10"
  496.     '    rtfNotes.SelStart = 0
  497.     PropertyChanged "Notes"
  498. End Property
  499. Public Property Get Caption() As String
  500.     Caption = lblCaption
  501. End Property
  502. Public Property Let Caption(ByVal New_Caption As String)
  503.     Dim strFirst As String
  504.     Dim strSecond As String
  505.     Dim strNewString As String
  506.     PropertyChanged "Caption"
  507.     '// Check for the ampersand character and
  508.     '// add another one to make it visible
  509.     If InStr(1, New_Caption, "&", vbTextCompare) Then
  510.         strFirst = ParseString(New_Caption, "&", 1)
  511.         strSecond = ParseString(New_Caption, "&", 2)
  512.         strNewString = strFirst & "&&" & strSecond
  513.     Else
  514.         strNewString = New_Caption
  515.     End If
  516.     lblCaption = strNewString
  517. End Property
  518. Public Property Get Enabled() As Boolean
  519. Attribute Enabled.VB_Description = "Returns/sets a value that determines whether an object can respond to user-generated events."
  520.     Enabled = UserControl.Enabled
  521. End Property
  522. Public Property Let Enabled(ByVal New_Enabled As Boolean)
  523.     UserControl.Enabled() = New_Enabled
  524.     PropertyChanged "Enabled"
  525. End Property
  526. Function Find(strFind As String) As Boolean
  527.     Dim lngRet As Long
  528.     Dim strBuffer As String
  529.     Dim objRTF As Control
  530.     '// Find text in the current edit window
  531.     Select Case tbsTab.SelectedItem.Index
  532.         Case 1
  533.             Set objRTF = rtfCode
  534.         Case 2
  535.             Set objRTF = rtfExample
  536.         Case 3
  537.             Set objRTF = rtfNotes
  538.         Case Else
  539.     End Select
  540.     If Not (objRTF Is Nothing) Then
  541.         strBuffer = objRTF.Text
  542.         lngRet = InStr(1, strBuffer, strFind, vbTextCompare)
  543.         If lngRet <> 0 Then
  544.             objRTF.SelStart = lngRet - 1
  545.             objRTF.SelLength = Len(strFind)
  546.             Find = True
  547.             Exit Function
  548.         End If
  549.         MsgBox "Word not found."
  550.         Find = False
  551.     End If
  552. End Function
  553. Private Sub lblAbout_DragDrop(Source As Control, X As Single, Y As Single)
  554.     If Source Is lblAbout Then
  555.         With lblAbout
  556.             frmAbout.Show vbModal
  557.             .Font.Underline = False
  558.             .ForeColor = &H80FF&
  559.         End With
  560.     End If
  561. End Sub
  562. Private Sub lblAbout_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
  563.     If State = vbLeave Then
  564.         With lblAbout
  565.             .Drag vbEndDrag
  566.             .Font.Underline = False
  567.             .ForeColor = &H80FF&
  568.         End With
  569.     End If
  570. End Sub
  571. Private Sub lblAbout_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  572.     With lblAbout
  573.         .ForeColor = vbBlue
  574.         .Font.Underline = True
  575.         .Drag vbBeginDrag
  576.     End With
  577. End Sub
  578. Private Sub lblFeatures_DragDrop(Source As Control, X As Single, Y As Single)
  579.     If Source = lblFeatures Then
  580.         With lblFeatures
  581.             MsgBox "Feature (excuse the pun!) not yet implemented :)"
  582.             .Font.Underline = False
  583.             .ForeColor = &H80FF&
  584.         End With
  585.     End If
  586. End Sub
  587. Private Sub lblFeatures_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
  588.     If State = vbLeave Then
  589.         With lblFeatures
  590.             .Drag vbEndDrag
  591.             .Font.Underline = False
  592.             .ForeColor = &H80FF&
  593.         End With
  594.     End If
  595. End Sub
  596. Private Sub lblFeatures_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  597.     With lblFeatures
  598.         .ForeColor = vbBlue
  599.         .Font.Underline = True
  600.         .Drag vbBeginDrag
  601.     End With
  602. End Sub
  603. Private Sub lblUrl_DragDrop(Source As Control, X As Single, Y As Single)
  604.     If Source Is lblURL Then
  605.         With lblURL
  606.             ShowUrl .Caption
  607.             .Font.Underline = False
  608.             .ForeColor = &H80FF&
  609.         End With
  610.     End If
  611. End Sub
  612. Private Sub lblUrl_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
  613.     If State = vbLeave Then
  614.         With lblURL
  615.             .Drag vbEndDrag
  616.             .Font.Underline = False
  617.             .ForeColor = &H80FF&
  618.         End With
  619.     End If
  620. End Sub
  621. Private Sub lblUrl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  622.     With lblURL
  623.         .ForeColor = vbBlue
  624.         .Font.Underline = True
  625.         .Drag vbBeginDrag
  626.     End With
  627. End Sub
  628. Private Sub lvDetails_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  629.     If Button = vbRightButton Then
  630.         m_cDetails.Restore "FileMenu"
  631.         If lvDetails.SelectedItem Is Nothing Then
  632.             m_cDetails.Enabled(m_cDetails.IndexForKey("EDIT")) = False
  633.             m_cDetails.Enabled(m_cDetails.IndexForKey("DELETE")) = False
  634.             m_cDetails.Enabled(m_cDetails.IndexForKey("EXPORT")) = False
  635.         Else
  636.             If InStr(lvDetails.SelectedItem.Key, "L") Then ' Item is a link
  637.                 m_cDetails.Enabled(m_cDetails.IndexForKey("EXPORT")) = False
  638.                 m_cDetails.Enabled(m_cDetails.IndexForKey("EDIT")) = True
  639.                 m_cDetails.Enabled(m_cDetails.IndexForKey("DELETE")) = False
  640.             Else
  641.                 m_cDetails.Enabled(m_cDetails.IndexForKey("EXPORT")) = True
  642.                 m_cDetails.Enabled(m_cDetails.IndexForKey("EDIT")) = False
  643.                 m_cDetails.Enabled(m_cDetails.IndexForKey("DELETE")) = True
  644.             End If
  645.         End If
  646.         Call m_cDetails.ShowPopupMenu(X + 50, Y + lvDetails.tOp + (lblCaption.Height * 2))
  647.     End If
  648.     sngListViewX = X
  649.     sngListViewY = Y
  650. End Sub
  651. Private Sub m_cDetails_Click(ItemNumber As Long)
  652.     Dim strPath As String
  653.     Dim lngRetVal As Long
  654.     Dim liItem As ListItem
  655.     Dim strFile As String
  656.     Select Case m_cDetails.ItemKey(ItemNumber)
  657.         Case "IMPORT" ' Import a file
  658.             strPath = frmMain.ShowFileDialog(eOpen, "", "File name to import...", "")
  659.             If strPath <> "" Then modFiles.InsertFile strPath
  660.             strFile = Right$(modData.Description, 3)
  661.             Set liItem = lvDetails.ListItems.Add(, modData.Key, strFile)
  662.             liItem.SubItems(1) = modData.Description
  663.         Case "EXPORT" ' Export a file
  664.             modFiles.OutputFile lvDetails
  665.         Case "HLINK" ' Insert a hyperlink
  666.             g_strLink = ""
  667.             g_strName = ""
  668.             frmInput.Show vbModal
  669.             DoEvents
  670.             If g_blnEnd = True Then ' The Input form has unloaded
  671.                 modFiles.InsertLink g_strLink, g_strName
  672.                 DoEvents
  673.                 With lvDetails
  674.                     Set liItem = .ListItems.Add(, modData.Key, modData.Description)
  675.                     liItem.SubItems(1) = g_strLink
  676.                 End With
  677.             End If
  678.         Case "EDIT" ' Edit or remove a hyperlink
  679.             If lvDetails.SelectedItem Is Nothing Then MsgBox "Please select an item.": Exit Sub
  680.             lngRetVal = MsgBox("Would you like to delete this link?", vbYesNo + vbQuestion)
  681.             If lngRetVal = vbYes Then
  682.                 modData.EditLink lvDetails.SelectedItem.Key, True, lvDetails
  683.             Else
  684.                 g_strName = lvDetails.SelectedItem.Text
  685.                 g_strLink = lvDetails.SelectedItem.SubItems(1)
  686.                 frmInput.Show vbModal
  687.                 If g_blnEnd = True Then
  688.                     modData.EditLink lvDetails.SelectedItem.Key, False, lvDetails, g_strLink, g_strName
  689.                 End If
  690.             End If
  691.         Case "DELETE"
  692.             If lvDetails.SelectedItem Is Nothing Then Exit Sub
  693.             lngRetVal = MsgBox("Are you sure you want to delete this file?", vbYesNo + vbCritical)
  694.             If lngRetVal = vbYes Then
  695.                 modData.Key = lvDetails.SelectedItem.Key
  696.                 modData.DeleteFile lvDetails
  697.             End If
  698.     End Select
  699. End Sub
  700. Private Sub m_cMenu_Click(ItemNumber As Long)
  701.     Dim sName As String
  702.     Dim sEmail As String
  703.     Dim sWeb As String
  704.     Dim sCompany As String
  705.     Dim sLine As String
  706.     Dim sHeader As String
  707.     '// Handle context menu clicks
  708.     Select Case m_cMenu.ItemKey(ItemNumber)
  709.         Case "HEADER"
  710.             sName = GetSetting(ThisApp, "General", "Name", "")
  711.             sEmail = GetSetting(ThisApp, "General", "Email", "")
  712.             sWeb = GetSetting(ThisApp, "General", "Web", "")
  713.             sCompany = GetSetting(ThisApp, "General", "Company", "")
  714.             sLine = "'----------------------------------------"
  715.             sHeader = sLine & vbCrLf & "'- Name:" & vbTab & sName
  716.             sHeader = sHeader & vbCrLf & "'- Email:" & vbTab & sEmail
  717.             sHeader = sHeader & vbCrLf & "'- Web:" & vbTab & sWeb
  718.             sHeader = sHeader & vbCrLf & "'- Company:" & vbTab & sCompany
  719.             sHeader = sHeader & vbCrLf & sLine
  720.             sHeader = sHeader & vbCrLf & "'- Notes: " & vbTab
  721.             sHeader = sHeader & vbCrLf & "'" & vbTab & vbTab
  722.             sHeader = sHeader & vbCrLf & sLine
  723.             Select Case tbsTab.SelectedItem.Index
  724.                 Case 1
  725.                     rtfCode.SelStart = 0
  726.                     Clipboard.SetText sHeader & vbCrLf
  727.                     rtfCode.PasteCode
  728.                 Case 2
  729.                     rtfExample.SelStart = 0
  730.                     Clipboard.SetText sHeader & vbCrLf & vbCrLf & rtfExample.Text
  731.                     rtfExample.PasteCode
  732.                 Case 3
  733.                     rtfNotes.SelStart = 0
  734.                     rtfNotes.Text = sHeader & vbCrLf & vbCrLf & rtfNotes.Text
  735.                 Case Else
  736.             End Select
  737.         Case "COPY"
  738.             Copy
  739.         Case "CUT"
  740.             Cut
  741.         Case "PASTE"
  742.             Paste
  743.         Case "DELETE"
  744.             If frmMain.tvwItems.SelectedItem Is Nothing Then
  745.                 MsgBox "No item selected.", vbOKOnly + vbInformation
  746.                 Exit Sub
  747.             End If
  748.             modData.Key = frmMain.tvwItems.SelectedItem.Key
  749.             modData.DeleteNode frmMain.tvwItems
  750.         Case "SELECTALL"
  751.             SelectAll
  752.         Case "COLOUR"
  753.             frmMain.tbrMain.ButtonEnabled("COLOUR") = False
  754.             DoEvents
  755.             Colour
  756.         Case "FIND"
  757.             frmFind.Show vbModal
  758.         Case "PRINT"
  759.             PrintCode
  760.         Case Else
  761.     End Select
  762. End Sub
  763. Private Sub picTabContainer_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  764.     lblAbout.ForeColor = &H80FF&
  765. End Sub
  766. Private Sub rtfCode_GotFocus()
  767.     Dim Control As Object
  768.     On Error Resume Next
  769.     '// Allow tabs in the edit window
  770.     For Each Control In Controls
  771.         Control.TabStop = False
  772.     Next Control
  773. End Sub
  774. Private Sub rtfCode_KeyUp(KeyCode As Integer, Shift As Integer)
  775.     '// Enable/Disable the cut/copy/paste items
  776.     If rtfCode.SelLength = 0 Then
  777.         frmMain.tbrMain.ButtonEnabled("CUT") = False
  778.         frmMain.tbrMain.ButtonEnabled("COPY") = False
  779.     Else
  780.         frmMain.tbrMain.ButtonEnabled("CUT") = True
  781.         frmMain.tbrMain.ButtonEnabled("COPY") = True
  782.     End If
  783.     frmMain.tbrMain.ButtonEnabled("PASTE") = Clipboard.GetFormat(vbCFRTF)
  784. End Sub
  785. Private Sub rtfCode_LostFocus()
  786.     '// Update the code if necessary
  787.     modData.CompareCode frmMain.tvwItems, rtfCode.TextRTF, "Code"
  788. End Sub
  789. Private Sub rtfCode_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  790.     If rtfCode.SelLength = 0 Then
  791.         frmMain.tbrMain.ButtonEnabled("CUT") = False
  792.         frmMain.tbrMain.ButtonEnabled("COPY") = False
  793.     Else
  794.         frmMain.tbrMain.ButtonEnabled("CUT") = True
  795.         frmMain.tbrMain.ButtonEnabled("COPY") = True
  796.     End If
  797. End Sub
  798. Private Sub rtfCode_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  799.     Dim lngMenu As Long
  800.     '// Show the context menu
  801.     If Button = vbRightButton Then
  802.         m_cMenu.Restore "DataMenu"
  803.         m_cMenu.Enabled(m_cMenu.IndexForKey("PASTE")) = Clipboard.GetFormat(vbCFText)
  804.         If rtfCode.SelLength = 0 Then
  805.             m_cMenu.Enabled(m_cMenu.IndexForKey("COPY")) = False
  806.             m_cMenu.Enabled(m_cMenu.IndexForKey("CUT")) = False
  807.         End If
  808.         lngMenu = m_cMenu.ShowPopupMenu(X, Y + rtfCode.tOp + (lblCaption.Height * 2))
  809.     End If
  810.     If rtfCode.SelLength = 0 Then
  811.         frmMain.tbrMain.ButtonEnabled("CUT") = False
  812.         frmMain.tbrMain.ButtonEnabled("COPY") = False
  813.     Else
  814.         frmMain.tbrMain.ButtonEnabled("CUT") = True
  815.         frmMain.tbrMain.ButtonEnabled("COPY") = True
  816.     End If
  817. End Sub
  818. Private Sub rtfCode_SelChange()
  819.     '// Enable/Disable the cut/copy/paste items
  820.     If rtfCode.SelLength = 0 Then
  821.         frmMain.tbrMain.ButtonEnabled("CUT") = False
  822.         frmMain.tbrMain.ButtonEnabled("COPY") = False
  823.     Else
  824.         frmMain.tbrMain.ButtonEnabled("CUT") = True
  825.         frmMain.tbrMain.ButtonEnabled("COPY") = True
  826.     End If
  827.     frmMain.tbrMain.ButtonEnabled("PASTE") = Clipboard.GetFormat(vbCFRTF)
  828. End Sub
  829. Private Sub rtfExample_LostFocus()
  830.     '// Update the example if necessary
  831.     modData.CompareCode frmMain.tvwItems, rtfExample.TextRTF, "Example"
  832. End Sub
  833. Private Sub rtfExample_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  834.     Dim lngMenu As Long
  835.     '// Show the context menu
  836.     If Button = vbRightButton Then
  837.         m_cMenu.Restore "DataMenu"
  838.         m_cMenu.Enabled(m_cMenu.IndexForKey("PASTE")) = Clipboard.GetFormat(vbCFText)
  839.         If rtfExample.SelLength = 0 Then
  840.             m_cMenu.Enabled(m_cMenu.IndexForKey("COPY")) = False
  841.             m_cMenu.Enabled(m_cMenu.IndexForKey("CUT")) = False
  842.         End If
  843.         lngMenu = m_cMenu.ShowPopupMenu(X, Y + rtfCode.tOp + (lblCaption.Height * 2))
  844.     End If
  845. End Sub
  846. Private Sub rtfNotes_GotFocus()
  847.     '// Disable the colour button
  848.     frmMain.tbrMain.ButtonEnabled("COLOUR") = False
  849. End Sub
  850. Private Sub rtfNotes_LostFocus()
  851.     '// Update the code if necessary
  852.     modData.CompareCode frmMain.tvwItems, rtfNotes.TextRTF, "Notes"
  853.     frmMain.tbrMain.ButtonEnabled("COLOUR") = True
  854. End Sub
  855. Private Sub rtfNotes_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  856.     Dim lngMenu As Long
  857.     '// Show the context menu
  858.     If Button = vbRightButton Then
  859.         m_cMenu.Restore "DataMenu"
  860.         m_cMenu.Enabled(m_cMenu.IndexForKey("PASTE")) = Clipboard.GetFormat(vbCFText)
  861.         If rtfNotes.SelLength = 0 Then
  862.             m_cMenu.Enabled(m_cMenu.IndexForKey("COPY")) = False
  863.             m_cMenu.Enabled(m_cMenu.IndexForKey("CUT")) = False
  864.         End If
  865.         m_cMenu.Enabled(m_cMenu.IndexForKey("COLOUR")) = False
  866.         lngMenu = m_cMenu.ShowPopupMenu(X, Y + rtfCode.tOp + (lblCaption.Height * 2))
  867.     End If
  868. End Sub
  869. Private Sub tbsTab_Click()
  870.     Static PrevTab As Integer
  871.     PrevTab = Switch(PrevTab = 0, 1, PrevTab >= 1 And PrevTab <= NumberOfTabs, PrevTab)
  872.     picTabContainer(PrevTab).Visible = False
  873.     picTabContainer(tbsTab.SelectedItem.Index).Visible = True
  874.     picTabContainer(tbsTab.SelectedItem.Index).Refresh
  875.     PrevTab = tbsTab.SelectedItem.Index
  876.     DoEvents
  877. End Sub
  878. Private Sub tbsTab_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  879.     lblURL.ForeColor = &H80FF&
  880. End Sub
  881. Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  882.     lblAbout.ForeColor = &H80FF&
  883. End Sub
  884. Private Sub UserControl_Resize()
  885.     '// Resize our panels
  886.     With lblCaption
  887.         .Move ScaleLeft, ScaleTop, ScaleWidth, .Height
  888.     End With
  889.     With tbsTab
  890.         .Move UserControl.ScaleLeft, lblCaption.Height, UserControl.ScaleWidth, UserControl.ScaleHeight - lblCaption.Height
  891.     End With
  892.     With picTabContainer(1)
  893.         .tOp = tbsTab.ClientTop
  894.         .Width = tbsTab.ClientWidth
  895.         .left = tbsTab.ClientLeft
  896.         .Height = tbsTab.ClientHeight
  897.         .Move .left, .tOp, .Width, .Height
  898.     End With
  899.     With picTabContainer(2)
  900.         .tOp = tbsTab.ClientTop
  901.         .Width = tbsTab.ClientWidth
  902.         .left = tbsTab.ClientLeft
  903.         .Height = tbsTab.ClientHeight
  904.         .Move .left, .tOp, .Width, .Height
  905.     End With
  906.     With picTabContainer(3)
  907.         .tOp = tbsTab.ClientTop
  908.         .Width = tbsTab.ClientWidth
  909.         .left = tbsTab.ClientLeft
  910.         .Height = tbsTab.ClientHeight
  911.         .Move .left, .tOp, .Width, .Height
  912.     End With
  913.     With picTabContainer(4)
  914.         .tOp = tbsTab.ClientTop
  915.         .Width = tbsTab.ClientWidth
  916.         .left = tbsTab.ClientLeft
  917.         .Height = tbsTab.ClientHeight
  918.         .Move .left, .tOp, .Width, .Height
  919.     End With
  920.     With picTabContainer(5)
  921.         .tOp = tbsTab.ClientTop
  922.         .Width = tbsTab.ClientWidth
  923.         .left = tbsTab.ClientLeft
  924.         .Height = tbsTab.ClientHeight
  925.         .Move .left, .tOp, .Width, .Height
  926.     End With
  927.     With tbsTab
  928.         rtfCode.Move ScaleLeft, 0, .ClientWidth - rtfCode.left, .ClientHeight
  929.         rtfExample.Move ScaleLeft, 0, .ClientWidth - rtfCode.left, .ClientHeight
  930.         rtfNotes.Move ScaleLeft, 0, .ClientWidth - rtfCode.left, .ClientHeight
  931.         lvDetails.Move ScaleLeft, 0, .ClientWidth - lvDetails.left, .ClientHeight
  932.     End With
  933.     With lblTitle
  934.         .Move .left, .tOp, tbsTab.ClientWidth, .Height
  935.     End With
  936.     With shpBorder
  937.         .Move .left, lblTitle.tOp + lblTitle.Height, .Width, tbsTab.ClientHeight - lblTitle.Height
  938.     End With
  939.     '// Remove the annoying text wrapping
  940.     rtfCode.RightMargin = rtfCode.Width * 8
  941.     rtfExample.RightMargin = rtfExample.Width * 8
  942. End Sub
  943. Public Sub Initalize()
  944.     Dim intCount As Integer
  945.     Dim blnControl As Boolean
  946.     Dim blnTab As Boolean
  947.     Dim intTabIndex As Integer
  948.     Dim intIndex As Integer
  949.     '// Organise our tabs
  950.     For intCount = 1 To NumberOfTabs
  951.         With picTabContainer(intCount)
  952.             .BorderStyle = 0
  953.             .left = tbsTab.ClientLeft
  954.             .tOp = tbsTab.ClientTop
  955.             .Width = tbsTab.ClientWidth
  956.             .Height = tbsTab.ClientHeight
  957.             .Visible = False
  958.         End With
  959.     Next intCount
  960.     '// Set the default caption
  961.     lblCaption.Caption = "Developers Code Book"
  962.     '// Adjust the list view controls
  963.     SetControl
  964.     '// Show the last used tab
  965.     blnTab = GetSetting(ThisApp, "General", "Remember Tabs", True)
  966.     If blnTab Then
  967.         intTabIndex = Val(GetSetting(ThisApp, "General", "Data Control", 1))
  968.         '// Thanks to Randy Ledyard
  969.         If intTabIndex = 0 Then intTabIndex = 1
  970.         tbsTab.Tabs(intTabIndex).Selected = True
  971.     End If
  972.     '// Init the popupmenu
  973.     Set m_cMenu = New cPopupMenu
  974.     With m_cMenu
  975.         .ImageList = frmMain.ilsMenu
  976.         .hwndOwner = UserControl.hwnd
  977.         .GradientHighlight = True
  978.         .Clear
  979.         '// Add the items
  980.         .AddItem "Insert &Header", , , , 24, , , "HEADER"
  981.         .AddItem "&Delete Item", , , , 14, , , "DELETE"
  982.         .AddItem "-", , , , , , , "SEP1"
  983.         .AddItem "Cu&t", , , , 6, , , "CUT"
  984.         .AddItem "&Copy", , , , 7, , , "COPY"
  985.         .AddItem "&Paste", , , , 8, , , "PASTE"
  986.         .AddItem "Select &All", , , , 22, , , "SELECTALL"
  987.         .AddItem "-", , , , , , , "SEP2"
  988.         .AddItem "Syntax Highlight", , , , 20, , , "COLOUR"
  989.         .AddItem "Find", , , , 21, , , "FIND"
  990.         .AddItem "Print code", , , , 23, , , "PRINT"
  991.         .Store "DataMenu"
  992.     End With
  993.     Set m_cDetails = New cPopupMenu
  994.     With m_cDetails
  995.         .ImageList = frmMain.ilsMenu
  996.         .hwndOwner = UserControl.hwnd
  997.         .GradientHighlight = True
  998.         .Clear
  999.         .AddItem "&Import File", , , , 15, , , "IMPORT"
  1000.         .AddItem "&Export File", , , , 16, , , "EXPORT"
  1001.         .AddItem "&Delete File", , , , 14, , , "DELETE"
  1002.         .AddItem "-"
  1003.         .AddItem "&Insert Hyperlink", , , , 11, , , "HLINK"
  1004.         .AddItem "&Edit/Remove Hyperlink", , , , 25, , , "EDIT"
  1005.         .Store "FileMenu"
  1006.     End With
  1007.     '// Count the items
  1008.     CountItems frmMain.tvwItems
  1009.     rtfCode.ColourComment = GetSetting(ThisApp, "Colour", "Comment", RGB(0, 127, 0))
  1010.     rtfExample.ColourComment = rtfCode.ColourComment
  1011.     rtfCode.ColourKeyword = GetSetting(ThisApp, "Colour", "Keyword", RGB(0, 0, 127))
  1012.     rtfExample.ColourKeyword = rtfCode.ColourKeyword
  1013.     rtfCode.ColourText = GetSetting(ThisApp, "Colour", "Text", RGB(0, 0, 0))
  1014.     rtfExample.ColourText = rtfCode.ColourText
  1015.     rtfNotes.Font.Size = "10"
  1016.     lblDBVer.Caption = lblDBVer.Caption & " " & App.Major
  1017.     modData.GetLinks lvDetails
  1018.     modData.GetFiles lvDetails
  1019. End Sub
  1020. Sub SelectTab(intTab As Integer)
  1021.     tbsTab.Tabs(intTab).Selected = True
  1022. End Sub
  1023. Sub SelectAll()
  1024.     Select Case tbsTab.SelectedItem.Index
  1025.         Case 1
  1026.             rtfCode.SelStart = 0
  1027.             rtfCode.SelLength = Len(rtfCode.Text)
  1028.         Case 2
  1029.             rtfExample.SelStart = 0
  1030.             rtfExample.SelLength = Len(rtfExample.Text)
  1031.         Case 3
  1032.             rtfNotes.SelStart = 0
  1033.             rtfNotes.SelLength = Len(rtfNotes.Text)
  1034.         Case Else
  1035.     End Select
  1036.     frmMain.tbrMain.ButtonEnabled("CUT") = True
  1037.     frmMain.tbrMain.ButtonEnabled("COPY") = True
  1038. End Sub
  1039. Sub Copy()
  1040.     '// You may want to remove this line
  1041.     '// It was put in because of problems copying
  1042.     Clipboard.Clear
  1043.     Select Case tbsTab.SelectedItem.Index
  1044.         Case 1
  1045.             Clipboard.SetText rtfCode.SelText
  1046.         Case 2
  1047.             Clipboard.SetText rtfExample.SelText
  1048.         Case 3
  1049.             Clipboard.SetText rtfNotes.SelText
  1050.         Case Else
  1051.     End Select
  1052. End Sub
  1053. Sub Cut()
  1054.     Select Case tbsTab.SelectedItem.Index
  1055.         Case 1
  1056.             Clipboard.SetText rtfCode.SelText
  1057.             rtfCode.SelText = ""
  1058.         Case 2
  1059.             Clipboard.SetText rtfExample.SelText
  1060.             rtfExample.SelText = ""
  1061.         Case 3
  1062.             Clipboard.SetText rtfNotes.SelText
  1063.             rtfNotes.SelText = ""
  1064.         Case Else
  1065.     End Select
  1066. End Sub
  1067. Sub Colour()
  1068.     '// Colours the current edit windows code
  1069.     Select Case tbsTab.SelectedItem.Index
  1070.         Case 1
  1071.             rtfCode.Colour rtfCode, True
  1072.             DoEvents
  1073.             rtfCode.SetFocus
  1074.         Case 2
  1075.             rtfExample.Colour rtfExample, True
  1076.             DoEvents
  1077.             rtfExample.SetFocus
  1078.         Case Else
  1079.     End Select
  1080.     DoEvents
  1081.     frmMain.tbrMain.ButtonEnabled("COLOUR") = True
  1082. End Sub
  1083. Public Sub PrintCode()
  1084.     ' Code by Jeffj
  1085.     rtfCode.SelPrint Printer.hdc, frmMain.cmdDialog
  1086. End Sub
  1087. Sub SetControl()
  1088.     Dim lStyle As Long
  1089.     Dim lHeaderHWND As Long
  1090.     Dim lLVHwnd As Long
  1091.     Dim lCount As Long
  1092.     '// Authored by Chris Eastwood
  1093.     lLVHwnd = lvDetails.hwnd
  1094.     SendMessageLong lLVHwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT, True
  1095.     '
  1096.     ' Turn off Redrawing at this point to speed up / hide the visible changes
  1097.     '
  1098.     SendMessageLong lvDetails.hwnd, WM_SETREDRAW, False, &O0
  1099.     For lCount = 0 To lvDetails.ColumnHeaders.Count - 1
  1100.         Call SendMessageLong(lvDetails.hwnd, LVM_SETCOLUMNWIDTH, lCount, ByVal LVSCW_AUTOSIZE_USEHEADER)
  1101.     Next
  1102.     '
  1103.     ' Turn Redrawing back on
  1104.     '
  1105.     SendMessageLong lvDetails.hwnd, WM_SETREDRAW, True, &O0
  1106. End Sub
  1107. Sub Terminate()
  1108.     Dim intTabIndex As Integer
  1109.     Dim blnTab As Boolean
  1110.     '// Save the current tab
  1111.     blnTab = GetSetting(ThisApp, "General", "Remember Tabs", True)
  1112.     If blnTab = True Then
  1113.         SaveSetting ThisApp, "General", "Data Control", tbsTab.SelectedItem.Index
  1114.     End If
  1115.     If Not (m_cDetails Is Nothing) Then
  1116.         m_cDetails.Clear
  1117.         m_cDetails.DestroySubClass
  1118.     End If
  1119.     Set m_cDetails = Nothing
  1120. End Sub
  1121. Public Function Undo() As Boolean
  1122.     Select Case tbsTab.SelectedItem.Index
  1123.         Case 1
  1124.             SendMessage rtfCode.hwnd, EM_UNDO, 0&, 0&
  1125.         Case 2
  1126.             SendMessage rtfExample.hwnd, EM_UNDO, 0&, 0&
  1127.         Case 3
  1128.             SendMessage rtfNotes.hwnd, EM_UNDO, 0&, 0&
  1129.         Case Else
  1130.     End Select
  1131. End Function
  1132. Public Function CanUndo() As Boolean
  1133.     Select Case tbsTab.SelectedItem.Index
  1134.         Case 1
  1135.             CanUndo = SendMessage(rtfCode.hwnd, EM_CANUNDO, 0&, 0&)
  1136.         Case 2
  1137.             CanUndo = SendMessage(rtfExample.hwnd, EM_CANUNDO, 0&, 0&)
  1138.         Case 3
  1139.             CanUndo = SendMessage(rtfNotes.hwnd, EM_CANUNDO, 0&, 0&)
  1140.         Case Else
  1141.     End Select
  1142. End Function
  1143. Public Sub Details(blnShow As Boolean)
  1144.     picTabContainer(tbsTab.SelectedItem.Index).Visible = blnShow
  1145.     tbsTab.Enabled = blnShow
  1146. End Sub
  1147. Public Sub Paste()
  1148.     Select Case tbsTab.SelectedItem.Index
  1149.         Case 1
  1150.             rtfCode.PasteCode
  1151.         Case 2
  1152.             rtfExample.PasteCode
  1153.         Case 3
  1154.             rtfNotes.SelRTF = Clipboard.GetText(vbCFRTF)
  1155.         Case Else
  1156.             rtfCode.PasteCode
  1157.     End Select
  1158. End Sub
  1159. Public Property Get PlainCode() As String
  1160.     PlainCode = rtfCode.Text
  1161. End Property
  1162. Public Property Get PlainNotes() As String
  1163.     PlainNotes = rtfNotes.Text
  1164. End Property
  1165. Public Sub Redraw(blnRedraw As Boolean)
  1166.     If blnRedraw Then
  1167.         SendMessage UserControl.hwnd, WM_SETREDRAW, True, 0&
  1168.     Else
  1169.         SendMessage UserControl.hwnd, WM_SETREDRAW, False, 0&
  1170.     End If
  1171. End Sub
  1172. Public Sub CountItems(tvw As TreeView)
  1173.     '// If the number of items exceeds 67,000 then
  1174.     '// the API should be used because the treeviews
  1175.     '// Nodes.Count method fails to work
  1176.     lblItems = "Number of items: " & tvw.Nodes.Count - 1
  1177. End Sub
  1178. Public Function Comment(lngNewClr As Long) As Long
  1179.     rtfCode.ColourComment = lngNewClr
  1180.     rtfExample.ColourComment = lngNewClr
  1181.     Comment = rtfExample.ColourComment
  1182.     SaveSetting ThisApp, "Colour", "Comment", lngNewClr
  1183. End Function
  1184. Public Function Keyword(lngNewClr As Long) As Long
  1185.     rtfCode.ColourKeyword = lngNewClr
  1186.     rtfExample.ColourKeyword = lngNewClr
  1187.     Keyword = rtfExample.ColourKeyword
  1188.     SaveSetting ThisApp, "Colour", "Keyword", lngNewClr
  1189. End Function
  1190. Public Function TextC(lngNewClr As Long) As Long
  1191.     rtfCode.ColourText = lngNewClr
  1192.     rtfExample.ColourText = lngNewClr
  1193.     TextC = rtfExample.ColourText
  1194.     SaveSetting ThisApp, "Colour", "Text", lngNewClr
  1195. End Function
  1196. Private Sub ShowUrl(strUrl As String)
  1197.     Call ShellExecute(0&, vbNullString, strUrl, vbNullString, vbNullString, vbNormalFocus)
  1198. End Sub
  1199. 'After trapping these coordinates, pass them to the HitTest method of the ListView control during the DoubleClick event to determine whether a user has double-clicked on a particular ListItem object:
  1200. Private Sub lvDetails_DblClick()
  1201.     Dim lListItem As ListItem
  1202.     Set lListItem = lvDetails.HitTest(sngListViewX, _
  1203.             sngListViewY)
  1204.     If (lListItem Is Nothing) Then
  1205.     Else
  1206.         If InStr(lListItem.Key, "L") Then ShellExecute 0&, vbNullString, lListItem.SubItems(1), vbNullString, vbNullString, vbNormalFocus
  1207.     End If
  1208.     Set lListItem = Nothing
  1209. End Sub
  1210. Sub SetColours()
  1211.     rtfCode.ColourComment = GetSetting(ThisApp, "Colour", "Comment", RGB(0, 127, 0))
  1212.     rtfExample.ColourComment = rtfCode.ColourComment
  1213.     rtfCode.ColourKeyword = GetSetting(ThisApp, "Colour", "Keyword", RGB(0, 0, 127))
  1214.     rtfExample.ColourKeyword = rtfCode.ColourKeyword
  1215.     rtfCode.ColourText = GetSetting(ThisApp, "Colour", "Text", RGB(0, 0, 0))
  1216.     rtfExample.ColourText = rtfCode.ColourText
  1217.     rtfNotes.Font.Size = "10"
  1218. End Sub
  1219.