home *** CD-ROM | disk | FTP | other *** search
- Option Explicit
-
- Const COLORS16_VALUES = "0;8388608;32768;8421376;128;8388736;32896;12632256;8421504;16711680;65280;16776960;255;16711935;65535;16777215"
-
- Dim msFullCode
- Dim marProcedures
-
- Sub ShowCode()
- Dim sHtml, i
-
- On Error Resume Next
- 'get source and replace tabs with spaces
- msFullCode = Replace(idMainCode.innerHTML,chr(9)," ")
-
- For i = 1 To Len(msFullCode)
- If IsCharAlpha(Mid(msFullCode, i, 1)) Then
- msFullCode = Mid(msFullCode, i)
- Exit For
- End If
- Next
-
- 'msFullCode = Replace(msFullCode, "_" & chr(13) & chr(10), "")
-
- msFullCode = Trim(PaintCode(msFullCode))
- 'make div
- sHtml = "<p> </p>"
- sHtml = sHtml & "<DIV class=clsExampleGrid>"
- sHtml = sHtml & "<table class= clsExampleTitleBar cellspacing=0>"
- sHtml = sHtml & "<tr>"
- sHtml = sHtml & "<td width=18><img class=clsWinImage src=Class.png></td>"
- sHtml = sHtml & "<td width=100%><b>Sample Code</b></td>"
- sHtml = sHtml & "<td width=18><img class=clsWinImage src=MinWin.png></td>"
- sHtml = sHtml & "<td width=18><img class=clsWinImage src=MaxWin.png></td>"
- sHtml = sHtml & "<td width=18><img class=clsCloseWinImage src=CloseWin.png"
- sHtml = sHtml & " OnClick=" & chr(34) & "window.history.back()" & chr(34) & "></td>"
- sHtml = sHtml & "</tr>"
- sHtml = sHtml & "</table><br>"
-
- sHtml = sHtml & "<select size=1 name=cmbObject valign=Top style=" & chr(34)
- sHtml = sHtml & "position: relative; width: 48%; top: -7" & chr(34)
- sHtml = sHtml & " OnChange=" & chr(34) & "SetCurrentObject()" & chr(34) & ">"
- 'sHtml = sHtml & "<option value=General selected>General</option>"
- sHtml = sHtml & "</select> "
- sHtml = sHtml & "<select size=1 name=cmbProcedures valign=Top style=" & chr(34)
- sHtml = sHtml & "position: relative; width: 48%; top: -7" & chr(34)
- sHtml = sHtml & " OnChange=" & chr(34) & "ShowProc()" & chr(34) & ">"
- 'sHtml = sHtml & "<option value=Declarations selected>Declarations</option>"
- sHtml = sHtml & "</select>"
- sHtml = sHtml & "<div id=idCodeWindow class=clsExampleCode>"
- 'sHtml = sHtml & "<PRE><CODE>" & msFullCode & "</PRE></CODE>"
- sHtml = sHtml & "</div></div>"
-
- idShowCode.innerHTML = sHtml
-
- LoadProcedures
- window.navigate "#bkSourcecode"
-
- End Sub
-
- Private Sub LoadProcedures()
- Dim arLines, i, iPos
- Dim sProcs, oOption
- Dim cmb, sTmp, sTmpList
-
- Set cmb = cmbObject
-
- arLines = Split(msFullCode, Chr(13))
- sProcs = "General_Declarations;"
-
- For i = 0 To Ubound(arLines)
- arLines(i) = ClearTags(arLines(i))
- arLines(i) = Replace(arLines(i), Chr(13), "")
- arLines(i) = Replace(arLines(i), Chr(10), "")
- arLines(i) = Replace(arLines(i), Chr(8),"")
-
- If IsLineProcStart(arLines(i)) Then
- iPos = InStr(arLines(i), "(")
- If iPos = 0 Then
- If Right(arLines(i), 1) = "_" Then
- arLines(i) = Left(arLines(i), Len(arLines(i)) - 1)
- arLines(i) = Trim(arLines(i))
- iPos = Len(arLines(i)) + 1
- End If
- End If
- If iPos > 0 Then
- arLines(i) = Left(arLines(i), iPos - 1)
- iPos = InStrRev(arLines(i), " ")
- If iPos > 0 Then
- arLines(i) = Trim(Mid(arLines(i), iPos + 1))
- iPos = InStr(arLines(i), "_")
- If iPos > 0 Then
- sProcs = sProcs & arLines(i) & ";"
- Else
- sProcs = sProcs & "General_" & arLines(i) & ";"
- End If
- End If
- End If
- End If
- Next
-
- marProcedures = Split(sProcs, ";")
- sTmpList = "0"
-
- for i = 0 to Ubound(marProcedures) - 1
- sTmp = Left(marProcedures(i),InStr(marProcedures(i), "_") - 1)
- If InStr(sTmpList, "(" & sTmp & ")") = 0 Then
- sTmpList = sTmpList & "(" & sTmp & ")"
- set oOption= document.createElement("OPTION")
- cmb.options.add oOption
-
- oOption.Text = sTmp
- oOption.Value = sTmp
- End If
- Next
-
- SetCurrentObject
- End Sub
-
- Sub SetCurrentObject()
- Dim cmb, sObject, i, sTmp, oOption
-
- Set cmb = cmbProcedures
-
- For i=0 To cmb.children.length - 1
- cmb.removeChild cmb.children(0)
- next
-
- sObject = cmbObject.Value
-
- for i = 0 to Ubound(marProcedures) - 1
- sTmp = Left(marProcedures(i),InStr(marProcedures(i), "_") - 1)
- If sTmp = sObject Then
-
- set oOption= document.createElement("OPTION")
- cmb.options.add oOption
-
- oOption.Text = Mid(marProcedures(i),InStr(marProcedures(i), "_") + 1)
- oOption.Value = marProcedures(i)
- End If
- Next
-
- ShowProc
- End Sub
-
- Sub ShowProc()
- Dim iPos, sName, sCode
- Dim iEndPos
-
- sName = cmbProcedures.Value
-
- iPos = GetProcStart(sName)
-
- If iPos > 0 Then
- iPos = InStrRev(msFullCode, Chr(10), iPos)
- sCode = Mid(msFullCode, iPos + 1)
- iEndPos = GetProcEnd(sCode)
- sCode = Left(sCode, iEndPos)
- idCodeWindow.innerHTML = "<PRE><CODE>" & sCode & "</PRE></CODE>"
- Else
- idCodeWindow.innerHTML = "<PRE><CODE>" & msFullCode & "</PRE></CODE>"
- End If
-
- End Sub
-
- Function IsLineProcStart(sLine)
- Const TAXT_COMP = 1
-
- IsLineProcStart = False
-
- If StrComp(Left(sLine,4),"Sub ", TAXT_COMP) = 0 Then
- IsLineProcStart = True
- ElseIf StrComp(Left(sLine,9),"Function ", TAXT_COMP) = 0 Then
- IsLineProcStart = True
- ElseIf StrComp(Left(sLine,12),"Private Sub ", TAXT_COMP) = 0 Then
- IsLineProcStart = True
- ElseIf StrComp(Left(sLine,17),"Private Function ", TAXT_COMP) = 0 Then
- IsLineProcStart = True
- End If
-
- End Function
-
- Function GetProcStart(sName)
- Dim iPos, sLine
-
- sName = " " & Replace(sName, "General_", "")
-
- iPos = InStr(msFullCode, sName)
-
- Do Until iPos = 0
- sLine = GetCodeLine(msFullCode, iPos)
- sLine = ClearTags(sLine)
- If IsLineProcStart(sLine) Then Exit Do
- iPos = InStr(iPos + 1, msFullCode, sName)
- Loop
-
- iPos = GetProcCommentBlock(iPos)
-
- GetProcStart = iPos
- End Function
-
- Function GetProcCommentBlock(iPos)
- Dim sPrevLine, iPrevPos, bComment
-
- GetProcCommentBlock = iPos
- If iPos < 3 Then Exit Function
-
- iPrevPos = iPos - 2
-
- Do
- iPrevPos = InStrRev(msFullCode, Chr(13), iPrevPos - 2)
- sPrevLine = GetCodeLine(msFullCode, iPrevPos)
- sPrevLine = ClearTags(sPrevLine)
- If Len(sPrevLine) = 0 Then
- If bComment Then
- iPrevPos = InStr(iPrevPos + 1, msFullCode, Chr(13))
- Exit Do
- End If
- Else
- If Left(sPrevLine, 1) = "'" Then
- bComment = True
- Else
- If bComment = True Then
- Exit Do
- Else
- GetProcCommentBlock = iPos
- Exit Function
- End If
- End If
- End If
- Loop While iPrevPos > 3
-
- GetProcCommentBlock = iPrevPos
- End Function
-
- Function GetProcEnd(sCode)
- Dim iPosSub, iPosFunc
- Dim iPos, iEndLine
-
- iPosSub = Instr(1, sCode, "End Sub", 1)
- iPosFunc = Instr(1, sCode, "End Function", 1)
-
- If iPosSub > iPosFunc Then
- iPos = iPosFunc
- Else
- iPos = iPosSub
- End If
-
- If iPos = 0 Then iPos = iPosSub + iPosFunc
-
- If iPos = 0 Then
- iPos = Len(sCode)
- Else
- iEndLine = InStr(iPos, sCode, Chr(13))
- If iEndLine > 0 Then
- iPos = iEndLine
- Else
- iPos = Len(sCode)
- End If
- End If
-
- GetProcEnd = iPos
- End Function
-
- Function GetCodeLine(sCode, iStartPos)
- Dim sTmp, iPos
-
- sTmp = sCode
-
- If iStartPos = 0 then
- iPos = 0
- Else
- iPos = InStr(iStartPos, sTmp, Chr(13))
- End If
-
- If iPos > 0 Then sTmp = Left(sTmp , iPos - 1)
-
- iPos = InStrRev(sTmp, Chr(13))
- If iPos > 0 Then sTmp = Mid(sTmp , iPos + 1)
-
- sTmp = Replace(sTmp, Chr(10), "")
- sTmp = Replace(sTmp, Chr(8),"")
- GetCodeLine = Trim(sTmp)
- End Function
-
- Function ClearTags(sLine)
- Dim sTmp, sTmpEnd, iPos, iEndPos
-
- sTmp = sLine
-
- iPos = InStr(sTmp, "<")
-
- Do Until iPos = 0
- iEndPos = InStr(iPos + 1,sTmp, ">")
- If iEndPos = 0 Then Exit Do
- sTmpEnd = Mid(sTmp, iEndPos + 1)
- sTmp = Left(sTmp, iPos - 1) & sTmpEnd
- iPos = InStr(sTmp, "<")
- Loop
-
- ClearTags = Trim(sTmp)
- End Function
-
- Function PaintCode(sCode)
- Dim sChar, sWord , i
- Dim bSkip, bComment
- Const StartTag = "<font color=#000080>"
- Const CommentTag = "<font color=#008000>"
- Const EndTag = "</font>"
-
- On Error Resume Next
-
- sCode = sCode & " "
-
- Do Until i >= Len(sCode)
- i = i + 1
- sChar = Mid(sCode, i, 1)
- If IsCharAlpha(sChar) Then
- sWord = sWord & sChar
- Else
- If Asc(sChar) = 39 And Not bSkip And Not bComment Then
- bComment = True
- sCode = Left(sCode, i - 1) & CommentTag & Mid(sCode, i)
- i = i + Len(CommentTag)
- End If
-
- If Not bSkip And Not bComment And Len(sWord) > 0 Then
- If GetKeyWord(sWord) Then
- sCode = Left(sCode, i - Len(sWord) - 1) & StartTag & sWord & EndTag & Mid(sCode, i)
- i = i + Len(StartTag) + Len(EndTag)
- End If
- End If
-
- If Asc(sChar) = 13 And bComment Then
- bComment = False
- sCode = Left(sCode, i - 1) & EndTag & Mid(sCode, i)
- i = i + Len(EndTag)
- End If
-
- If Asc(sChar) = 34 Then bSkip = Not bSkip
-
- sWord = ""
- End If
- Loop
-
- sCode = Replace(sCode, EndTag & " " & StartTag, " ")
- sCode = Replace(sCode, EndTag & StartTag, " ")
- PaintCode = Left(sCode, Len(sCode) - 1)
- End Function
-
-
- Private Sub SetScriptColors()
- Dim sText, i
- Dim sChar, sWord
- Const StartTag = "<font color=#000080>"
- Const EndTag = "</font>"
-
- On Error Resume Next
-
- Do Until i >= Len(sText)
- i = i + 1
- sChar = Mid(sText, i, 1)
- If IsCharAlpha(sChar) Then
- sWord = sWord & sChar
- Else
- If GetKeyWord(sWord) Then
- sText = Left(sText, i - Len(sWord)) & StartTag & sWord & EndTag & Mid(sText, i + 1)
- i = i + Len(StartTag) + Len(EndTag)
- End If
- sWord = ""
- End If
- Loop
-
- sText = Replace(sText, EndTag & StartTag, " ")
-
- ' Do Until i = 0
- ' i = InStr(i, sText, "'")
- ' If i = 0 Then Exit Do
- ' rtf.SelStart = i - 1
- ' rtf.Span Chr(13), True, True
- ' rtf.SelColor = QBColor(2)
- ' i = i + Len(rtf.SelText) + 1
- ' Loop
-
- End Sub
-
- Private Function GetKeyWord(sWord)
- Dim iPos
- Const KeyWords = ";Abs;And;As;Asc;Atn;Call;Case;CCur;CDbl;Chr;CInt;CLng;Const;Cos;CSng;CStr;CVar;CVDate;End;DateAdd;DateDiff;DatePart;DateSerial;DateValue;Day;Dim;Do;Else;ElseIf;EndIf;Eqv;Erase;Err;Error;Exit;Exp;Explicit;False;Fix;For;Format;Function;GetObject;GoTo;Hex;Hour;If;Imp;Input;InputBox;InStr;Int;Is;IsDate;IsEmpty;IsNull;IsNumeric;LBound;LCase;Left;Len;Let;Like;LoadPicture;Log;Loop;LTrim;Mid;Minute;Mod;Month;MsgBox;New;Next;Not;Nothing;Now;Null;Oct;On;Option;Or;Preserve;Private;Random;Randomize;ReDim;Rem;Resume;RGB;Right;Rnd;RTrim;Second;Select;Set;Sgn;Sin;Space;Spc;Sqr;Static;Stop;Str;StrComp;Sub;Tan;Then;Time;Timer;TimeSerial;TimeValue;To;Trim;True;Type;TypeOf;UBound;UCase;Until;Val;VarType;Weekday;Wend;While;Xor;Year;CDate;FormatDateTime;Each;Split;"
-
- iPos = InStr(1, KeyWords, ";" & sWord & ";",vbTextCompare)
-
- If iPos > 0 Then
- sWord = Mid(KeyWords, iPos + 1, Len(sWord))
- GetKeyWord = True
- End If
- End Function
-
- Private Function IsCharAlpha(sChar)
- Dim iKey
-
- iKey = Asc(UCase(sChar))
-
- If iKey > 64 And iKey < 91 Then 'key is char
- IsCharAlpha = True
- End If
- End Function
-
- Sub FillColorCombo(combo,lDefault)
- dim i,oOption
- dim arColors,arColorValues
-
- Const WEB_COLORS = "Aliceblue#16775408;Antiquewhite#14150650;Aqua#16776960;Aquamarine#13959039;Azure#16777200;Beige#14480885;Bisque#12903679;Black#0;Blanchedalmond#13495295;Blue#16711680;Blueviolet#14822282;Brown#2763429;Burlywood#8894686;Cadetblue#10526303;Chartreuse#65407;Chocolate#1993170;Coral#5275647;Cornflower#15570276;Cornsilk#14481663;Crimson#3937500;Cyan#16776960;Darkblue#9109504;Darkcyan#9145088;Darkgoldenrod#755384;Darkgray#11119017;Darkgreen#100;Darkkhaki#7059389;Darkmagenta#9109643;Darkolivegreen#3107669;Darkorange#36095;Darkorchid#13382297;Darkred#139;Darksalmon#8034025;Darkseagreen#9157775;Darkslateblue#9125192;Darkslategray#5197615;Darkturquoise#13749760;Darkviolet#148;Deeppink#9639167;Deepskyblue#16760576;Dimgray#6908265;Dodgerblue#16748574;Firebrick#2237106;Floralwhite#15792895;Forestgreen#2263842;Fuchsia#16711935;Gainsboro#14474460;Ghostwhite#16775416;Gold#55295;Goldenrod#2139610;Gray#8421504;Green#128;Greenyellow#3145645;Honeydew#15794160;Hotpink#11823615;Indianred#6053069;Indigo#8519755;Ivory#15794175;Khaki#9234160;Lavender#16443110;Lavenderblush#16118015;Lawngreen#64636;Lemonchiffon#13499135;Lightblue#15128749;Lightcoral#8421616;Lightcyan#16777184;Lightgoldenrodyellow#13826810;Lightgreen#9498256;Lightgray#13882323;Lightpink#12695295;Lightsalmon#8036607;Lightseagreen#11186720;Lightskyblue#16436871;Lightslategray#10061943;Lightsteelblue#14599344;Lightyellow#14745599;Lime#65280;Limegreen#3329330;Linen#15134970;Magenta#16711935;Maroon#128;Mediumaquamarine#11193702;Mediumblue#13434880;Mediumorchid#13850042;Mediumpurple#14381203;Mediumseagreen#7451452;Mediumslateblue#15624315;Mediumspringgreen#10156544;Mediumturquoise#13422920;Mediumvioletred#8721863;Midnightblue#7346457;Mintcream#16449525;Mistyrose#14804223;Moccasin#11920639;Navajowhite#11394815;Navy#32896;Oldlace#15136253;Olive#32896;Olivedrab#2330219;Orange#42495;Orangered#17919;Orchid#14053594;Palegoldenrod#11200750;Palegreen#10025880;Paleturquoise#15658671;Palevioletred#9662683;Papayawhip#14020607;Peachpuff#12180223;Peru#4163021;Pink#13353215;Plum#14524637;Powderblue#15130800;Purple#8388736;Red#255;Rosybrown#9408444;Royalblue#9464129;Saddlebrown#1262987;Salmon#7504122;Sandybrown#6333684;Seagreen#5737262;Seashell#15660543;Sienna#2970272;Silver#12632256;Skyblue#15453831;Slateblue#13458026;Slategray#9470064;Snow#16448255;Springgreen#8388352;Steelblue#11829830;Tan#9221330;Teal#8421504;Thistle#14204888;Tomato#4678655;Turquoise#13688896;Violet#15631086;Wheat#11788021;White#16777215;Whitesmoke#16119285;Yellow#65535;Yellowgreen#3329434"
-
- On Error Resume Next
-
- arColors=Split(WEB_COLORS,";")
-
- If lDefault <> -1 Then
- set oOption= document.createElement("OPTION")
- combo.options.add oOption
-
- oOption.Text = "Default"
- oOption.Value = lDefault
- End If
-
- for i=0 to Ubound(arColors)
- set oOption= document.createElement("OPTION")
- combo.options.add oOption
-
- arColorValues = Split(arColors(i),"#")
-
- oOption.Text = arColorValues(0)
- oOption.Value = arColorValues(1)
- Next
- End Sub
-
- Sub ShowApplyTo(sFileName)
- dim sStream , PopUp
-
- Set PopUp = document.all("idMembersList")
-
- If PopUp.style.visibility = "hidden" Then
- ShowAtPoint PopUp
- Else
- PopUp.style.visibility = "hidden"
- End If
- End Sub
-
- Sub ShowAtPoint(oPopUp)
- Dim elm, ieX, ieY
-
- set elm = window.event.srcElement
-
- window.event.returnValue = false
- window.event.cancelBubble = true
-
- if elm is nothing then
- ieX = window.event.clientX
- ieY = window.event.clientY + document.body.scrollTop
- else
- ieX = elm.offsetLeft
- ieY = ((elm.offsetTop) + (elm.offsetHeight) + 1)
- end if
-
- oPopUp.style.top = ieY
- oPopUp.style.left = ieX
-
- oPopUp.style.visibility = "visible"
-
- set elm = Nothing
- End Sub
-
- Sub HideApplyTo()
- On Error resume next
-
- document.all("idMembersList").style.visibility = "hidden"
- document.all("sapop").className = "clsMenuText"
- End Sub
-