View Single Post
  #2  
Old 13-12-2007, 06:25
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

something like this, a non-tested rip from my working macros. All the function dealing with x,y have optional parameter specifying hotArea, play with it to determine the one you need.

I'm not sure about double-clicking event interception...Depends on your workflow with the macro, personally for a single-op. macros I prefer such procedure: hover a mouse over a shape, press a hotkey invoking the macro. And of course in my case the macro uses GetCursorPos winapi instead of GetUserClick.
Code:
sub AddNode()
dim x#, y#, shift&, sh as Shape, seg as Segment, offs&, N as Node

If ActiveDocument.GetUserClick(x, y, shift, 10, True, cdrCursorWinCross) <> 0 Then Exit Sub

with ActivePage.SelectShapesAtPoint(x, y, 0).Shapes
   if .Count=0 then exit sub
   set sh=.Item(.Count)
end with

if sh.IsOnShape(x,y)<>cdrOnMarginOfShape then exit sub

set seg=FoundShape.Curve.FindSegmentAtPoint(x,y,Offs)

set N=seg.AddNodeAt(Offs)
Reply With Quote