Product : Engine, Version : 5.1.1.1038, ArticleID : 41024154

HowTo : How to use the Events and URLs in HTML code

Article41024154
TypeHowTo
ProductEngine
Version5.1.1.1038
Date Added11/23/2005
Submitted byMattheos Kotzias
Keywords

Subject

How to use the Events and URLs in HTML code

Summary

How to use the Events and URLs in HTML code

Solution

Try a HTML page like this. Note: When you want to pass a value to a VectorDraw event you should use SetEventParamValue method.

<html><head>
<title>VectorDraw test HTML</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">

<script language="vbscript">
Sub Vdraw_AfterOpenDocument()
 Vdraw.Palette.Item(0) = "(200,255,255)" ' For testing
 ' Use : Vdraw.Palette.Item(0) = "(255,255,255)"
End Sub

Sub Vdraw_CreateControl()
    Vdraw.Palette.Item(0) = "(255,155,25)"
    VDraw.MousePointer = 1
End Sub

Sub Open_onclickDWG()
 Vdraw.ActiveDocument.Open "vdtest.dwg"
 Vdraw.CommandAction.Zoom "E","",""
end sub

sub Open_fromDisk()
 Vdraw.ActiveDocument.Open ""
 Vdraw.CommandAction.Zoom "E","",""
end sub

sub Save_As()
 Vdraw.ActiveDocument.SaveAs ""
end sub

Sub Vdraw_OpenURL(URLname, Cancel)
' msgbox "Opening : " & cstr(urlname)
 Vdraw.ActiveDocument.Open URLname
 Vdraw.SetEventParamValue 1, "1" 
End Sub

Sub vdraw_GetSaveFileFilterFormat(FileFilterFormats)
    Dim filetypes
   
    filetypes = ""
    filetypes = "VDF 5x0 (*.vdf)|*.vdf|" & _
              "VDF 4x6 (*.vdf)|*.vdf|" & _
              "VDF 4x5 (*.vdf)|*.vdf|" & _
              "VDF 4x4 (*.vdf)|*.vdf|" & _
              "VDF 4x3 (*.vdf)|*.vdf|" & _
              "VDF 4x2 (*.vdf)|*.vdf|" & _
              "VDF 4x1 (*.vdf)|*.vdf|" & _
              "VDF 4x0 (*.vdf)|*.vdf|" & _
              "VDI 5x0 (*.vdi)|*.vdi|" & _
              "VDI 4x6 (*.vdi)|*.vdi|" & _
              "VDI 4x5 (*.vdi)|*.vdi|" & _
              "VDI 4x4 (*.vdi)|*.vdi|" & _
              "VDI 4x3 (*.vdi)|*.vdi|" & _
              "VDI 4x2 (*.vdi)|*.vdi|" & _
              "VDI 4x1 (*.vdi)|*.vdi|" & _
              "VDI 4x0 (*.vdi)|*.vdi|" & _
              "VDP (*.vdp)|*.vdp|" & _
              "DWG 2004 (*.dwg)|*.dwg|" & _
              "DWG 2000 (*.dwg)|*.dwg|" & _
              "DWG 14 (*.dwg)|*.dwg|" & _
              "DWG 13 (*.dwg)|*.dwg|" & _
              "DWG 11 (*.dwg)|*.dwg|" & _
              "DWG 10 (*.dwg)|*.dwg|"
    filetypes = filetypes & "DXF 2004 (*.dxf)|*.dxf|" & _
              "DXF 2000 (*.dxf)|*.dxf|" & _
              "DXF 14 (*.dxf)|*.dxf|" & _
              "DXF 13 (*.dxf)|*.dxf|" & _
              "DXF 11 (*.dxf)|*.dxf|" & _
              "DXF 10 (*.dxf)|*.dxf|" & _
              "DGN 8 (*.dgn)|*.dgn|" & _
              "XML (*.xml)|*.xml|" & _
              "WMF (*.wmf)|*.wmf|" & _
              "EMF (*.emf)|*.emf|" & _
              "BMP (*.bmp)|*.bmp|" & _
              "GIF (*.gif)|*.gif|" & _
              "JPG (*.jpg)|*.jpg|" & _
              "TIF (*.tif)|*.tif|" & _
              "PNG (*.png)|*.png|" & _
              "TGA (*.tga)|*.tga|" & _
              "|" & _
              "? 500 ? 406 ? 405 ? 403 ? 403 ? 402 ? 401 ? 400 ? 500 ? 406 ? 405 ? 403 ? 403 ? 402 ? 401 ? 400 ? 100 ? 8 ? 7 ? 6 ? 5 ? 4 ? 3 ? 8 ? 7 ? 6 ? 5 ? 4 ? 3 ? 51 ? 100"
              'FileFilterFormats = filetypes
 ' msgbox "Save : " & filetypes
 Vdraw.SetEventParamValue 0, cstr(filetypes)
End Sub

Sub vdraw_GetOpenFileFilterFormat(FileFilterFormats)
    Dim strFilter
    strFilter = "All Drawing Files(vdf/vdi/vdp/dwg/dxf/dgn/xml)|*.vdf;*.vdi;*.vdp;*.dwg;*.dxf;*.dgn;*.xml|All Image files(bmp/jpg/gif/tif/png/tga)|*.bmp;*.jpg;*.gif;*.tif;*.png;*.tga||"
 msgbox "open" & strFilter
 Vdraw.SetEventParamValue 0, cstr(strFilter)
End Sub

Sub Vdraw_IsValidOpenFormat(FileExtension , bvalid )
 Dim str 
 If FileExtension = ".dwg" Or FileExtension = ".dxf" Or FileExtension = ".dgn" Then
    Vdraw.SetEventParamValue 1, True 
 End If
End Sub

Sub Vdraw_NeedFileConvert(FileToOpen, TempFileName, CadVer , success )
Dim parameters
Dim destfilename
Dim src 
Dim actions 
Dim appPath 

 destfilename = TempFileName
 src = FileToOpen
 success = False
 actions = Vdraw.ActionValidates
 If Not (actions And 4194304) = 4194304 Then actions = actions + 4194304
 If Not (actions And 8388608) = 8388608 Then actions = actions + 8388608
 parameters = "? " + src + "? " + destfilename + "? " + CStr(CadVer) + " ? 1024 ? 768" + " ? " + CStr(actions) + " ? 0 ? 0 ? 1"
 appPath = Vdraw.GetUserValue("DrawingConvertAppPath", "vdconv.exe") 'find the full path of vdconv.exe
 success = Vdraw.VdShellExecute("", appPath, parameters, 0)
 Vdraw.SetEventParamValue 3, success 
End Sub

</script></head>
 <body>
  <p>

   <INPUT id="Open3" type="button" value="OpenDWG" name="Open vdtest.dwg" onclick="Open_onclickDWG">
   <INPUT id="Open4" type="button" value="Open" name="Open from disk" onclick="Open_fromDisk">
   <INPUT id="Save5" type="button" value="SaveAS" name="Save As" onclick="Save_As">
   <OBJECT CLASSID = "clsid:5220cb21-c88d-11cf-b347-00aa00a28331" VIEWASTEXT>
     <PARAM NAME="LPKPath" VALUE="vdraw.lpk">
   </OBJECT>
  </p>
  <p>
   <OBJECT id="Vdraw" height="400"
    width="800" align="baseline" border="0" 
    codeBase="xvdview5.cab#version=5,0,1,1035"
    classid="clsid:85CAEBA4-F545-48c6-90BC-AEA124686727"
    VIEWASTEXT>
    <PARAM NAME="PanWaitTime" VALUE="0">
    <PARAM NAME="BkColor" VALUE="0">
    <PARAM NAME="PickSize" VALUE="10">
    <PARAM NAME="CrossSize" VALUE="1200">
    <PARAM NAME="ScrollBar" VALUE="3">
    <PARAM NAME="StatusBar" VALUE="-1">
    <PARAM NAME="PropFileName" VALUE="">
    <PARAM NAME="VDrawRes" VALUE="">
    <PARAM NAME="MousePointer" VALUE="0">
    <PARAM NAME="ActionValidates" VALUE="16778240">
    <PARAM NAME="EnableToolTips" VALUE="1">
    <PARAM NAME="EnableURLs" VALUE="1">
    <PARAM NAME="ShowWCSAxis" VALUE="0">
    <PARAM NAME="DwgCodePage" VALUE="system">
    <PARAM NAME="CurveResolution" VALUE="500">
    <PARAM NAME="PenCaps" VALUE="1">
    <PARAM NAME="LicVAL" VALUE="Ask_VectorDraw_sales@vdraw.com">
    <PARAM NAME="LoadingInfo" VALUE="VectorDraw Corporation#www.vdraw.com">
   </OBJECT>
  </p>
 </body>
</html>