Jump to content
Software FX Community

Annotation objects and CurSel


User (Legacy)
 Share

Recommended Posts

Hi!

I am having troubles with detection of the currently selected annotation

object.

I use the following code to get the selection and check if it is a text box

or a balloon.

********************

IAnnObjectPtr pCurSel = m_pAnnotationList->CurSel;

IAnnGroupPtr pGroup;

IAnnTextPtr pObject;

if (pCurSel != NULL)

{

ObjectType type = (ObjectType)(short)pCurSel->ObjectType;

if (type == OBJECT_TYPE_TEXT || type == OBJECT_TYPE_BALLOON)

pObject = pCurSel;

else if (type == OBJECT_TYPE_GROUP)

{

pGroup = pCurSel;

if (pGroup->Count != 0)

{

pObject = pGroup->Item(_variant_t(long(0)));

type = (ObjectType)(short)pObject->ObjectType;

if (type != OBJECT_TYPE_TEXT && type != OBJECT_TYPE_BALLOON)

pObject = NULL;

}

}

}

if (pObject == NULL)

return;

m_pAnnotationList->ClearSelection();

...

********************

Sometimes it works but often it behaves strangely.

1) If I only have one text-box on the chart, CurSel usually returns an

object of type OBJECT_TYPE_GROUP with Count property equal to 0.

Why?

What is wrong with the above code?

2) Also, ClearSelection usually causes Access violation, the call stack is:

ANNOTATEX! 4400275c()

ANNOTATEX! 44002387()

Annotatex.dll 1.0.18.0

When is it safe to call ClearSelection?

Thanks,

Serge

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...