ClientNodeResources.Add

ClientNodeResources.Add

Anonymous
Not applicable
314 Views
2 Replies
Message 1 of 3

ClientNodeResources.Add

Anonymous
Not applicable

Another baffling discrepancy from the API help
files.  Note the emphasized text.


Description


Method that creates a new ClientNodeResource. The
new ClientNodeResource is returned. If no expanded icon is passed in, the node
ending up with this resource will use the standard icon as the icon to use when
it is expanded. The state icon is used to prefix the regular icon, typically
denoting the dynamic state of the object it represents.



Syntax


Public Function Add( _
   ByVal ClientId As String, _
   ByVal Id As Long, _
   ByVal Icon As Picture _
) As ClientNodeResource



Parameters



ClientId
Input string that uniquely identifies the
client. Some suggestions might be the ProgID of the Add-In creating the
resource, or its CLSID in a string form, e.g.
"{C9A6C580-3817-11D0-BE4E-080036E87B02}", although any unique string is valid.

Id
Input integer identifier that uniquely
identifies the resource to the client. This identifier
must be unique within the context of this owning document, and within this
AddIn.
The ClientId and the Id taken together uniquely
identify this object.

Icon
Input IPictureDisp of a 16X15 pixel image. Only
bitmaps are supported as a valid input type.

 

Inventor 10 apparently ignored the Id parameter,
as every ClientNodeResource I created used an Id of 0 and it worked.  In
Inventor 11, however, it would crash when the second ClientNodeResource was
created with a duplicate Id of 0.  These sorts of things drive us
codemonkeys crazy.  So which is it - the documentation for Inventor 10 was
wrong, or the Id parameter just simply wasn't implemented
correctly?




Brian R.
Iwaskewycz


style="FONT-SIZE: 14pt; FONT-FAMILY: Verdana">CAD Systems
Manager


style="FONT-SIZE: 14pt; FONT-FAMILY: Verdana">
href="http://www.corefurnace.com">Core Furnace Systems
0 Likes
315 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

Brian,

 

The change in behavior is the result of a defect
fix in R11. As the documentation states (or at least what it intended to convey
is that) we do require that you provide a unique combination of (ClientId
and Id) for a particular document. Though this was the designed behavior since
the method was introduced, we did not enforce this prior to R11. The fix in R11
was to check for uniqueness and fail if a non-unique combination is
provided.

 

I did some quick tests of providing duplicate Ids
in the method. But I was unable to reproduce the crash. The method simply
failed. Are you able to consistently reproduce the crash? Any specific
workflows?

 

Sanjay-

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">


Another baffling discrepancy from the API help
files.  Note the emphasized text.


Description


Method that creates a new ClientNodeResource. The
new ClientNodeResource is returned. If no expanded icon is passed in, the node
ending up with this resource will use the standard icon as the icon to use
when it is expanded. The state icon is used to prefix the regular icon,
typically denoting the dynamic state of the object it represents.



Syntax


Public Function Add( _
   ByVal ClientId As String, _
   ByVal Id As Long, _
   ByVal Icon As Picture _
) As ClientNodeResource



Parameters



ClientId
Input string that uniquely identifies the
client. Some suggestions might be the ProgID of the Add-In creating the
resource, or its CLSID in a string form, e.g.
"{C9A6C580-3817-11D0-BE4E-080036E87B02}", although any unique string is
valid.

Id
Input integer identifier that uniquely
identifies the resource to the client. This
identifier must be unique within the context of this owning document, and
within this AddIn.
The ClientId and the Id taken
together uniquely identify this object.

Icon
Input IPictureDisp of a 16X15 pixel image.
Only bitmaps are supported as a valid input type.

 

Inventor 10 apparently ignored the Id
parameter, as every ClientNodeResource I created used an Id of 0 and it
worked.  In Inventor 11, however, it would crash when the second
ClientNodeResource was created with a duplicate Id of 0.  These sorts of
things drive us codemonkeys crazy.  So which is it - the documentation
for Inventor 10 was wrong, or the Id parameter just simply wasn't implemented
correctly?




Brian R.
Iwaskewycz


style="FONT-SIZE: 14pt; FONT-FAMILY: Verdana">CAD Systems
Manager


style="FONT-SIZE: 14pt; FONT-FAMILY: Verdana">
href="http://www.corefurnace.com">Core Furnace Systems
0 Likes
Message 3 of 3

Anonymous
Not applicable

I did some quick tests of providing
duplicate Ids in the method. But I was unable to reproduce the crash. The method
simply failed. Are you able to consistently reproduce the crash? Any specific
workflows?

 

Sorry Sanjay, "crash" wasn't the best choice of
terms.  You are right - the .Add method simply failed.




Brian R.
Iwaskewycz


style="FONT-SIZE: 14pt; FONT-FAMILY: Verdana">CAD Systems
Manager


style="FONT-SIZE: 14pt; FONT-FAMILY: Verdana">
href="http://www.corefurnace.com/">Core Furnace Systems

0 Likes