Šta je još ostalo
Da bi sve ovo atraktivno izgledalo, treba da dodate program koji će sinhronizovati TreeView kontrolu sa tekstom koji je prikazan u Browser-u. Kod za Back i Forward može se najlakše implementirati sa po linijom koda: brwPageBrowser.GoBack ili brwPageBrowser.GoForward. Da program ne bi dobijao RunTime Error svaki put kada kliknete na Back, a već ste na osnovnom dokumentu, dodajte jedno On Error Resume Next ispred ovih naredbi. Posle njih možete da testirate kod greške, pa ako je različit od 0, onemogućite klik na taster.
Po završetku aplikacije, ostaje vam da uz pomoć nekog HTML editora kreirate atraktivan Help. Predlažem da glavni topic bude HTML dokument koji će predstavljati sadržaj i obuhvatutu linkove ka ostalim temama i njihovim stranicama. Ostale teme možete da razdelite u više fajlova (svaki po jedna tema) ili da sve smestite u isti. Stranice unutar tema odvojite HTML tagovima i... nemojte zaboraviti da na mašini svog klijenta instalirate IE 4.0, bez njega vaš Help neće biti od velike pomoći.
Slika 1 |
Sub Main()
Dim strCommand As String
Dim intAnchor As Integer
Dim strSilentLog As String
Dim fSilent As Boolean
Dim fErr As Boolean
'(r)itaj parametre komandne linije
strCommand = Command()
'Uzmi prvi argument
intAnchor = InStr(LCase(strCommand), gstrSwitchPrefix1 & gstrAPPLICATIONPATH)
If intAnchor = 0 Then
intAnchor = InStr(LCase(strCommand), gstrSwitchPrefix2 & gstrAPPLICATIONPATH)
End If
If intAnchor > 0 Then
strCommand = Trim(Mid(strCommand, intAnchor + 2))
gstrHTMLFilesPath = strExtractFilenameArg(strCommand, fErr)
If fErr Then GoTo BadCommandLine
Else
'Komandni parametri ne postoje, završi program
End
End If
'Uzmi sledeći parametar
intAnchor = InStr(LCase(strCommand), gstrSwitchPrefix1 & gstrHELPINDEXPATH)
If intAnchor = 0 Then
intAnchor = InStr(LCase(strCommand), gstrSwitchPrefix2 & gstrHELPINDEXPATH)
End If
If intAnchor > 0 Then
strCommand = Trim(Mid(strCommand, intAnchor + 2))
gstrHelpFileNamePath = strExtractFilenameArg(strCommand, fErr)
If fErr Then GoTo BadCommandLine
Else
' Komandni parametar nije unet, završi program
End
End If
'Očitaj ime index fajla
intAnchor = InStr(LCase(strCommand), gstrSwitchPrefix1 & gstrINDEXTOSHOW)
If intAnchor = 0 Then
intAnchor = InStr(LCase(strCommand), gstrSwitchPrefix2 & gstrINDEXTOSHOW)
End If
If intAnchor > 0 Then
strCommand = Trim(Mid(strCommand, intAnchor + 2))
gstrSelectedNodeIndex = strExtractFilenameArg(strCommand, fErr)
If fErr Then GoTo BadCommandLine
Else
' Komandni parametri ne postoje, završi program
End
End If
Set mWorkForm = New frmMain
Load mWorkForm
mWorkForm.Show
mWorkForm.SetFocus
BadCommandLine:
End Sub
|
Slika 2 |
I000, I000, "Active Help TOC", "ActiveHelp-TOC.html",0
I001, I000, "Active Help Main Menu", "ActiveHelp-TOC.html",2
I100, I000, "Active Help Main Menu", "",0
I101, I100, "Main Active Help Screen", "FullActiveHelp.html#MainMenu",2
I200, I000, "Active Help First Page", "",0
I201, I200, "Active Help First Page", "FullActiveHelp.html#FirstPage",2
I202, I200, "Add New Second Page", "FullActiveHelp.html#SecondPage",2
|
Slika 3 |
If ndNodesList(nIndex).strNodeisTopic = 2 Then
'Prvo proverimo da li fajl postoji
'odvojimo html tag od imena fajla
strHelpIndexFilePath = gstrHTMLFilesPath &
FstrStripTagFromString(ndNodesList(nIndex).strNodePathtoHTML, "#")
If Dir(strHelpIndexFilePath) <> "" Then
strHelpIndexFilePath = gstrHTMLFilesPath & ndNodesList(nIndex).strNodePathtoHTML
strHelpIndexFilePath = FstrConvertToURL(strHelpIndexFilePath)
brwPageBrowser.Navigate strHelpIndexFilePath
Else
'prijavimo gresku
MsgBox ("Fajl nije pronadjen")
End If
Else
'Topic je nod, samo ga otvaramo
Node.Expanded = True
End If
|
Slika 4: FstrConvertToURL |
Public Function FstrConvertToURL(strInputString As String) As String
'Konvertuje dati path u IE prepoznatljiv URL
'Prvo pronalazi sve "\" i umesto njih stavlja "/"
Dim strTemp1 As String
Dim strTemp2 As String
Dim jj As Integer
'Na početak stringa stavi oznaku da je u pitanju fajl sa lokalnog diska
strTemp1 = "file:///" & strInputString
strTemp2 = ""
For jj = 1 To Len(strTemp1)
If Mid(strTemp1, jj, 1) = "\" Then
strTemp2 = strTemp2 & "/"
ElseIf Mid(strTemp1, jj, 1) = " " Then
strTemp2 = strTemp2 & "%20"
Else
strTemp2 = strTemp2 & Mid(strTemp1, jj, 1)
End If
Next jj
FstrConvertToURL = strTemp2
End Function
|
Slika 5 |
Public Sub ShowForm(Optional strHelpPath As String, Optional strHelpIndex As String)
'Function to Show form.
'Input variables:
' strHelpPath - File Path to HelpIndex.inx
' strHelpIndex - Index to htlm document to show
gstrHelpFileNamePath = strHelpPath
gstrSelectedNodeIndex = strHelpIndex
gstrHTMLFilesPath = strHelpIndexFilePath
mWorkForm.Show
mWorkForm.SetFocus
End Sub
|
Slika 6 |
Private Sub cmdHelp_Click()
'Poziv ActiveHelp
If Dir(App.Path & "\HelpFiles\HelpIndex.inx") <> "" Then
maxhClassQuickHelp.strHelpIndexFilePath = App.Path & "\ HelpFiles\"
maxhClassQuickHelp.ShowForm achmodeless, , App.Path & "\ HelpFiles\HelpIndex.inx", "I001"
Else
Dim bResponse As Boolean
bResponse = ReportHelpError
End If
End Sub
|
|