OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 13-12-2007, 00:08
flyer
Guest
 
Posts: n/a
Default double click to add point..

Been programming in VB, but new to VBA with corel x3.

to start what I want to do, I have to insert a node in a existing path, at a point where I double click, (like double clicking in shape tool mode). I will be doing a few things with that point once created, so I need to reference this new point in my code. I need to do this in the VBA code, since I will be creating quite a few new nodes to do what I want.

Once I get to this point, I should be OK.. Just hitting a road block getting started.

Thanks.
Reply With Quote
  #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
  #3  
Old 13-12-2007, 16:16
flyer
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by wOxxOm View Post
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)

ok, double click is not needed in macro to do what I want to do, sorry.

Where are you finding "FoundShape.Curve.FindSegmentAtPoint"??? I have looked through the Docs I have and find nothing like any of the 3 objects. As written "Offs" gives an error as argument, BTW.

This is pretty much what I was looking for and coudn't find it. That appears to be my road block.

Thanks for helping out. I appreciate it.
Reply With Quote
  #4  
Old 13-12-2007, 16:28
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

1. set seg=sh.Curve.FindSegmentAtPoint(x,y,Offs)
2. Offs must be declared as Double (Offs#)
3. I use F2 class browser and search within it

Good luck :-)
Reply With Quote
  #5  
Old 13-12-2007, 16:48
flyer
Guest
 
Posts: n/a
Default much better....

Thanks. much better. I gather that FoundShape was defined elsewhere in your macro??? I still cant find it, in object browser, or anywhere...

I was looking everywhere (segment, subpath, node, etc) but not "curve" sheesh...

Thanks

Maybe I can leave you alone for a while..

Don
Reply With Quote
  #6  
Old 13-12-2007, 16:54
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

:-) FoundShape is a dummy name, I've changed it to sh which is my fave for such an object, yet missed that line when changing
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[DrawX3] RectangleFixer not working!!! wOxxOm Macros/Add-ons 6 12-11-2007 12:41
Snap to Objects in Oberon ThreePointArc Macro dgearl CorelDRAW/Corel DESIGNER VBA 3 05-09-2006 12:58
having to dbl click in X3 for tools to work bloodgroove General 3 16-06-2006 13:46
Click and Drag Scaling similar to CAD applications JSC Feature requests/wishlist 2 31-10-2005 11:27
Where is the selected text? petig CorelDRAW/Corel DESIGNER VBA 7 16-05-2005 15:30


All times are GMT -5. The time now is 11:07.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com