Can someone give me a coding sample showing how to call the TransformPoint function from javascript.
Thank you for your help.
Maurice
>
If I understood correctly it cannot be done with JavaScript, only from VBScript.
The output of the function is passed in the parameters. JavaScript does not support ByRef
parameters, VBScript does.
Anyway, a VBScript(!) example that works for me:
Function screenToXYtxt(x, y, typ)
Dim px(3)
px(0)=2 ' Source screen coordinates
px(1)=x
px(2)=y
Dim py1(3)
py1(0)=typ
Eview.Viewer.TransformPoint px, py1
' Look a little further
px(1)=x+1
px(2)=y+1
Dim py2(3)
py2(0)=typ
Eview.Viewer.TransformPoint px, py2
accuracy=Log(py2(1)-py1(1))/Log(10)
ll=accuracy
If (accuracy>0) Then
accuracy=0
Else
accuracy = 1+Int(-accuracy)
End If
screenToXYtxt = "x="&FormatNumber(py1(1), accuracy)&" y="&FormatNumber(py1(2),
accuracy)
End Function
Sub Eview_OnMouseMove(nButtons, mX, mY, handled)
document.all.tooltip.innerHTML = "Drawing "&screenToXYtxt(mX, mY, 0) ' Drawing
document.all.tooltip2.innerHTML = "Paper "&screenToXYtxt(mX, mY, 1) ' Paper
handled = False
End Sub
--
Jos Groot Lipman
Visit www.furix.com for BetterWMF and CompareDWG
Furix BV
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"ggoodnig" <Do
href="mailto:grant.goodnight@usfilter.com">grant.goodnight@usfilter.com>
wrote in message
href="news:f19e650.1@WebX.maYIadrTaRb">news:f19e650.1@WebX.maYIadrTaRb...
you have to use vb script when calling a function which locates the x, y
coordinates? If so do you have an example of this? I have been using
JavaScript and the viewer keeps crashing.
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Larry Horner" <
href="mailto:larry@nospam.com">larry@nospam.com> wrote in message
href="news:54053120F1A88A4B5243363C7580688E@in.WebX.maYIadrTaRb">news:54053120F1A88A4B5243363C758......
Yes, unfortunately VBScript and Javascript have
completely different mechanism for array storage and being an ActiveX control,
I opted to implement for the former. However (and you probably know this
already but just for those who don't) you can call VBScript from Javascript
and visa versa so you can create a small VBScript wrapper function around
TransformPoint and keep the rest of your code in Javascript. Attached is a
sample app that uses the TranformPoint method in VBScript.
hope this helps,
Larry Horner
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"ggoodnig" <Do
href="mailto:grant.goodnight@usfilter.com">grant.goodnight@usfilter.com>
wrote in message
href="news:f19e650.1@WebX.maYIadrTaRb">news:f19e650.1@WebX.maYIadrTaRb...
you have to use vb script when calling a function which locates the x, y
coordinates? If so do you have an example of this? I have been using
JavaScript and the viewer keeps
crashing.