home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 25: Programming / pc_actual_25.iso / Basic / GridOne / setup.EXE / BEEGD10.CHM / scripts.vbs < prev    next >
Encoding:
Text File  |  2001-09-09  |  7.6 KB  |  326 lines

  1. Option Explicit
  2.  
  3. Dim mbSpanButtionActive 
  4.  
  5. Function CheckLicense(grd)
  6.    Dim sLic
  7.    const GRID_LIC = "Free Edition"
  8.  
  9.    On Error Resume Next
  10.  
  11.    sLic = Trim(grd.License)
  12.    sLic = Left(sLic, Len(GRID_LIC))
  13.  
  14.    If StrComp(GRID_LIC, sLic, vbTextCompare) = 0 Then 
  15.       window.navigate "NotInFree.htm"
  16.       CheckLicense = False
  17.    Else
  18.       CheckLicense = True
  19.    End If
  20. End Function
  21.  
  22. Sub ToggleExample(divID)
  23.    Dim example, example_body, example_head
  24.  
  25.     On Error Resume Next
  26.  
  27.    set example = document.all(divID)
  28.    if not example is Nothing then
  29.  
  30.       set example_body = example.children("example_body")
  31.       set example_head = example.children("example_head")
  32.       if example_body.style.display = "block" then
  33.          example_body.style.display = "none"
  34.             example_head.children("idExamIcon").src = "fld.png"
  35.             example_head.children("idExamCaption").innerText = " Show Example"
  36.             document.all("idMenuExample").className = "clsMenuText"
  37.       else
  38.          example_body.style.display = "block"
  39.             example_head.scrollIntoView
  40.              example_head.style.fontWeight ="Bold"
  41.             example_head.children("idExamIcon").src = "ofld.png"
  42.             example_head.children("idExamCaption").innerText = " Hide Example"         
  43.             document.all("idMenuExample").className = "clsMenuTextDown"
  44.       end if
  45.    end if
  46. End sub
  47.  
  48. Function ShowSeeAlso()
  49.     dim elm,ieX,ieY,PopUp
  50.  
  51.     On error resume next
  52.  
  53.     set PopUp=document.all.idPopUp_idPUPDIV_SeeAlso
  54.     
  55.     set elm = window.event.srcElement
  56.     
  57.     window.event.returnValue = false
  58.     window.event.cancelBubble = true
  59.  
  60.     If PopUp.style.visibility = "visible" Then
  61.         HidePopUp
  62.         elm.className = "clsMenuTextUp"
  63.         set PopUp = Nothing
  64.         set elm = Nothing
  65.         Exit Function
  66.     End If
  67.  
  68.     if elm is nothing then
  69.         ieX = window.event.clientX
  70.         ieY = window.event.clientY + document.body.scrollTop
  71.     else    
  72.         ieX = elm.offsetLeft
  73.         ieY = ((elm.offsetTop) + (elm.offsetHeight) + 1)
  74.     end if
  75.     
  76.     PopUp.style.top = ieY 
  77.     PopUp.style.left = ieX
  78.         
  79.     PopUp.style.visibility = "visible"
  80.  
  81. End Function
  82.  
  83. Sub HidePopUp()
  84.     dim divs
  85.  
  86.     On error resume next
  87.  
  88.     for each divs in document.all.tags("DIV")
  89.         if StrComp(divs.classname,"clsEnumPopUp",vbTextCompare)=0 Or StrComp(divs.classname,"clsPopUp",vbTextCompare)=0 then
  90.             divs.style.visibility = "hidden"
  91.         end if
  92.     next
  93.     
  94.     document.all("sapop").className = "clsMenuText"
  95. End Sub
  96.  
  97.  
  98. Sub InitPopUp()
  99.     dim tbl,sPopUp,sHtml
  100.     dim sPopUpId,div
  101.  
  102.     On error resume next
  103.     For each tbl in document.all.tags("TABLE")
  104.         if len(tbl.Id)>0 then
  105.             if instr(1,tbl.id,"idEnumTable",vbTextCompare)>0 then
  106.                 sHtml=tbl.innerHTML
  107.                 sHtml=replace(sHtml,"width=" & chr(34) & "96","width=" & chr(34) & "100")
  108.                 sPopUpId="idPopUp_"  & tbl.id
  109.                 sPopUp="<DIV ID=" & sPopUpId & " CLASS=clsEnumPopUp>" & sHtml & "</DIV>"
  110.  
  111.                 call document.body.insertAdjacentHTML("beforeEnd", sPopUp)                
  112.                 document.all(sPopUpId).innerHTML =tbl.innerHTML
  113.             
  114.             end if
  115.         end if
  116.     next
  117.  
  118.     for each div in document.all.tags("DIV")
  119.         if len(div.Id)>0 then
  120.             if instr(1,div.id,"idPUPDIV",vbTextCompare)>0 Then
  121.                 sHtml=div.innerHTML
  122.                 sPopUpId="idPopUp_"  & div.id
  123.                 sPopUp="<DIV ID=" & sPopUpId & " CLASS=clsPopUp>" & sHtml & "</DIV>"
  124.                 call document.body.insertAdjacentHTML("beforeEnd", sPopUp)                
  125.                 document.all(sPopUpId).innerHTML =div.innerHTML
  126.             end if
  127.         end if
  128.     next
  129.     
  130. End Sub
  131.  
  132. Sub ShowEnum(PopUpId)
  133.     dim elm,ieX,ieY,PopUp 
  134.     dim par,lWidth
  135.     const SCROLL_WIDTH = 24
  136.     On error resume next
  137.  
  138.     HidePopUp
  139.  
  140.     set PopUp=document.all(PopUpId)
  141.     
  142.     If PopUp is nothing then exit sub
  143.  
  144.     set elm = window.event.srcElement
  145.     
  146.     window.event.returnValue = false
  147.     window.event.cancelBubble = true
  148.     
  149.     if elm is nothing then
  150.         ieX = window.event.clientX
  151.         ieY = window.event.clientY + document.body.scrollTop
  152.     else    
  153.         ieX = elm.offsetLeft
  154.         lWidth = elm.offsetWidth
  155.         ieY = ((elm.offsetTop) + (elm.offsetHeight) + 1)
  156.  
  157.         Set par = elm.offsetParent
  158.  
  159.         Do until par is Nothing
  160.             lWidth = par.offsetWidth
  161.             ieX = ieX + par.offsetLeft
  162.             ieY = ieY + par.offsetTop
  163.             Set par = par.offsetParent
  164.         Loop
  165.     end if
  166.     
  167.     If (PopUp.offsetWidth + SCROLL_WIDTH) > (lWidth - ieX) Then        
  168.         If (PopUp.offsetWidth + SCROLL_WIDTH) > lWidth Then
  169.             ieX = 0
  170.         Else
  171.             ieX = lWidth - PopUp.offsetWidth - SCROLL_WIDTH
  172.         End If
  173.     End If
  174.  
  175.     PopUp.style.top = ieY 
  176.     PopUp.style.left = ieX
  177.         
  178.     PopUp.style.visibility = "visible"
  179.      
  180.     set PopUp=nothing
  181.     set elm=nothing
  182. End Sub
  183.  
  184. Sub ShowProperties(sObjectGUID)
  185.     window.navigate "Properties_properties_" & sObjectGUID & ".htm"
  186. End Sub
  187.  
  188. Sub ShowMethods(sObjectGUID)
  189.     window.navigate "Methods_methods_" & sObjectGUID & ".htm"
  190. End Sub
  191.  
  192. Sub ShowEvents(sObjectGUID)
  193.     window.navigate "Events_events_" & sObjectGUID & ".htm"
  194. End Sub
  195. 'buttons
  196. Sub document_onmouseover()
  197.     Dim eSrc
  198.  
  199.     On Error Resume Next
  200.  
  201.    mbSpanButtionActive = False
  202.  
  203.     set eSrc = window.event.srcElement
  204.  
  205.     If TypeName(eSrc) = "HTMLImg" Then
  206.         Set eSrc = eSrc.parentElement
  207.     End If
  208.  
  209.     If eSrc.className = "clsMenuText" Then
  210.         eSrc.className = "clsMenuTextUp"
  211.       mbSpanButtionActive = True
  212.     ElseIf eSrc.className = "clsExamMenuText" Then
  213.         eSrc.className = "clsExamMenuTextUp"
  214.       mbSpanButtionActive = True
  215.     End If
  216. End Sub
  217.  
  218. Sub document_onmouseout()
  219.     Dim eSrc
  220.  
  221.     On Error Resume Next
  222.  
  223.     set eSrc = window.event.srcElement
  224.  
  225.     If TypeName(eSrc) = "HTMLImg" Then
  226.         Set eSrc = eSrc.parentElement
  227.     End If
  228.  
  229.     If eSrc.className = "clsMenuTextUp" Or eSrc.className = "clsMenuTextDown" Then
  230.         if eSrc.Id = "sapop" Or eSrc.Id = "idMenuExample" Then
  231.             If eSrc.className = "clsMenuTextUp" Then
  232.                 eSrc.className = "clsMenuText"
  233.             End If
  234.         Else
  235.             eSrc.className = "clsMenuText"
  236.         End If
  237.     ElseIf eSrc.className = "clsExamMenuTextUp" Or eSrc.className = "clsExamMenuTextDown" Then
  238.         eSrc.className = "clsExamMenuText"
  239.     End If
  240. End Sub
  241.  
  242. Sub document_onmousedown()
  243.     Dim eSrc
  244.  
  245.     On Error Resume Next   
  246.    'skip ie bug with disabled buttons
  247.    If Not mbSpanButtionActive Then Exit sub
  248.  
  249.     set eSrc = window.event.srcElement
  250.  
  251.     If TypeName(eSrc) = "HTMLImg" Then
  252.         Set eSrc = eSrc.parentElement
  253.     End If
  254.  
  255.     If eSrc.className = "clsMenuTextUp" Then
  256.         eSrc.className = "clsMenuTextDown"
  257.     ElseIf eSrc.className = "clsExamMenuTextUp" Then
  258.         eSrc.className = "clsExamMenuTextDown"
  259.     End If
  260. End Sub
  261.  
  262. Sub document_onmouseup()
  263.     Dim eSrc
  264.  
  265.     On Error Resume Next
  266.    'skip ie bug with disabled buttons
  267.    If Not mbSpanButtionActive Then Exit sub
  268.  
  269.     set eSrc = window.event.srcElement     
  270.  
  271.     If TypeName(eSrc) = "HTMLImg" Then
  272.         Set eSrc = eSrc.parentElement
  273.     End If
  274.  
  275.     If eSrc.className = "clsMenuTextDown" Then
  276.       window.event.cancelBubble = true
  277.         if eSrc.Id <> "sapop" Then
  278.             eSrc.className = "clsMenuText"
  279.         End If
  280.     ElseIf eSrc.className = "clsExamMenuTextDown" Then
  281.         window.event.cancelBubble = true
  282.         eSrc.className = "clsExamMenuTextUp"
  283.     End If
  284. End Sub
  285. 'prevent button selection
  286. Sub document_OnSelectStart()
  287.    Dim eSrc,bCancle
  288.    
  289.     On Error Resume Next
  290.    
  291.     set eSrc = window.event.srcElement
  292.  
  293.     If TypeName(eSrc) = "HTMLImg" Then
  294.         Set eSrc = eSrc.parentElement
  295.     End If
  296.  
  297.    bCancle = (TypeName(eSrc) = "HTMLSpanElement")
  298.  
  299.    If not bCancle Then
  300.       bCancle = (eSrc.Id = "example_body")
  301.    End If
  302.  
  303.    If not bCancle Then
  304.       bCancle = (eSrc.ClassName = "runninghead")
  305.    End If
  306.  
  307.    If bCancle Then
  308.       window.event.cancelBubble = True
  309.       window.event.returnValue = False
  310.    End If
  311. End Sub
  312. 'end buttons
  313.  
  314. Function ReadXML(sFileName)
  315.    Dim xmlDoc
  316.    
  317.    On Error Resume Next
  318.  
  319.    Set xmlDoc = CreateObject("microsoft.xmldom")
  320.       
  321.    xmlDoc.Load sFileName
  322.    ReadXML = xmlDoc.xml
  323.    
  324.    Set xmlDoc = Nothing
  325.  
  326. End Function