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 27-02-2009, 16:26
Sablesword Sablesword is offline
Junior Member
 
Join Date: Aug 2006
Posts: 20
Default Checking to see if two variables refer to the same object

In particular, I'm trying to determine if two node variables both refer to the same node. I thought the "is" statement was suppose to do this, but I can't make it work.

Code:
 Dim s As Shape
 Dim nr As NodeRange
 Dim nd, nd2 As Node
 Dim boo As Boolean
 Set s = ActiveSelection.Shapes(1)
 If s.Type = cdrCurveShape Then
  Set nr = s.Curve.Selection
 End If
 Set nd = nr.LastNode
 Set nd2 = nr.LastNode
 boo = nd Is nd2
 If boo Then
    (do stuff)
 Else
   (do other stuff)
 End If
Even when I force nd and nd2 to refer to the same node, boo evaluates as "false." What am I overlooking here?
Reply With Quote
  #2  
Old 27-02-2009, 22:51
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

Many objects are just wrappers around internal objects/structures in CorelDRAW. In most cases, a new VBA object is returned that still points to the same underlying data. There are only a few cases where the same CorelDRAW object has one and only one VBA object. Such classes are Application, Document, Page, Layer, Shape. Can't think of any others even though there might be.

Other than those, you can't use VBA's "Is" keyword to see if the objects refer to the same CorelDRAW object. You will need to use other means. In your case, I would check AbsoluteIndex property of a node returned:

Code:
boo = (nd.AbsoluteIndex = nd2.AbsoluteIndex)
Reply With Quote
  #3  
Old 01-03-2009, 13:41
Sablesword Sablesword is offline
Junior Member
 
Join Date: Aug 2006
Posts: 20
Default

OK. Thanks for the explaination & the suggestion.
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
Checking folders and subfolders mateushenrico CorelDRAW/Corel DESIGNER VBA 1 21-02-2009 01:31
Returning values/variables from functions m31uk3 Code Critique 2 02-01-2008 09:38
Checking fill type knowbodynow CorelDRAW/Corel DESIGNER VBA 2 08-03-2006 03:18
Global Variables ddonnahoe CorelDRAW/Corel DESIGNER VBA 3 08-08-2005 17:10
Reset All Variables ddonnahoe Code Critique 0 06-01-2005 08:16


All times are GMT -5. The time now is 14:21.


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