IPXC_Annotation::Actions Property

From Tracker Software PDF SDK
Jump to: navigation, search
m (Automatic page editing by robot)
 
(3 intermediate revisions by 3 users not shown)
Line 3: Line 3:
 
{{#customTitle:IPXC_Annotation::Actions Property}}
 
{{#customTitle:IPXC_Annotation::Actions Property}}
 
{{#parentPage:PXV:IPXC_Annotation#Properties|Actions|property}}
 
{{#parentPage:PXV:IPXC_Annotation#Properties|Actions|property}}
{{ToWrite}}
 
{{ToReview}}
 
  
Property '''Actions''' returns or sets [[PXV:IPXC_ActionsList|list of actions]] associated with the annotation for specific [[PXV:PXC_TriggerType|trigger]]. For most annotations only <code>Trigger_Up</code> is used.
+
Property '''Actions''' returns or sets [[PXV:IPXC_ActionsList|list of actions]] associated with the annotation for the specific [[PXV:PXC_TriggerType|trigger]]. For most annotations only <code>Trigger_Up</code> is used.
  
 
== Syntax ==
 
== Syntax ==
 
<pre class="brush:cpp;gutter:false">HRESULT get_Actions([in]          PXC_TriggerType    nTrigger,
 
<pre class="brush:cpp;gutter:false">HRESULT get_Actions([in]          PXC_TriggerType    nTrigger,
                     [out, retval]  IPXC_ActionsList**  ppActions);
+
                     [out, retval]  IPXC_ActionsList**  pActions);
 
HRESULT put_Actions([in]  PXC_TriggerType    nTrigger,
 
HRESULT put_Actions([in]  PXC_TriggerType    nTrigger,
                     [in]  IPXC_ActionsList*  ppActions);
+
                     [in]  IPXC_ActionsList*  pActions);
 
</pre>
 
</pre>
  
Line 18: Line 16:
 
;nTrigger
 
;nTrigger
 
:[in]  Specifies the [[PXV:PXC_TriggerType|trigger]] for which list of action should set or retrieved.
 
:[in]  Specifies the [[PXV:PXC_TriggerType|trigger]] for which list of action should set or retrieved.
 +
 +
== Sample ==
 +
<pre class="brush:c#">//C#
 +
public bool HasInvalidPaths(PDFXEdit.IPXC_Annotation annot)
 +
{
 +
uint invalidCount = 0;
 +
uint GoTo = pxsInst.StrToAtom("GoTo");
 +
uint GoToR = pxsInst.StrToAtom("GoToR");
 +
uint Launch = pxsInst.StrToAtom("Launch");
 +
PDFXEdit.IPXC_ActionsList actions = annot.get_Actions(PDFXEdit.PXC_TriggerType.Trigger_Up);
 +
for (uint k = 0; k < actions.Count; k++)
 +
{
 +
if ((actions[k].Type == GoTo) || (actions[k].Type == GoToR))
 +
{
 +
PDFXEdit.IPXC_Action_Goto actionGoTo = (PDFXEdit.IPXC_Action_Goto)actions[k];
 +
if (actionGoTo.IsValid == false)
 +
{
 +
invalidCount++;
 +
}
 +
else if (actions[k].Type == GoToR)
 +
{
 +
PDFXEdit.IPXC_FileSpec path = actionGoTo.Target;
 +
if (File.Exists(path.DIPath) == false)
 +
invalidCount++;
 +
}
 +
 +
}
 +
else if (actions[k].Type == Launch)
 +
{
 +
PDFXEdit.IPXC_Action_Launch actionLaunch = (PDFXEdit.IPXC_Action_Launch)actions[k];
 +
if (actionLaunch.IsValid == false)
 +
{
 +
invalidCount++;
 +
}
 +
else
 +
{
 +
PDFXEdit.IPXC_FileSpec path = actionLaunch.FileSpec;
 +
if (path == null)
 +
{
 +
if (File.Exists(actionLaunch.FileName) == false)
 +
invalidCount++;
 +
}
 +
else
 +
{
 +
if (File.Exists(path.DIPath) == false)
 +
invalidCount++;
 +
}
 +
 +
}
 +
}
 +
}
 +
return (invalidCount > 0);
 +
}
 +
</pre>
  
 
== See Also ==
 
== See Also ==
 
[[PXV:IPXC_Annotation|IPXC_Annotation]]
 
[[PXV:IPXC_Annotation|IPXC_Annotation]]

Latest revision as of 03:55, 20 February 2017

Property Actions returns or sets list of actions associated with the annotation for the specific trigger. For most annotations only Trigger_Up is used.

Syntax

HRESULT get_Actions([in]           PXC_TriggerType     nTrigger,
                    [out, retval]  IPXC_ActionsList**  pActions);
HRESULT put_Actions([in]  PXC_TriggerType    nTrigger,
                    [in]  IPXC_ActionsList*  pActions);

Parameters

nTrigger
[in] Specifies the trigger for which list of action should set or retrieved.

Sample

//C#
public bool HasInvalidPaths(PDFXEdit.IPXC_Annotation annot)
{
	uint invalidCount = 0;
	uint GoTo = pxsInst.StrToAtom("GoTo");
	uint GoToR = pxsInst.StrToAtom("GoToR");
	uint Launch = pxsInst.StrToAtom("Launch");
	PDFXEdit.IPXC_ActionsList actions = annot.get_Actions(PDFXEdit.PXC_TriggerType.Trigger_Up);
	for (uint k = 0; k < actions.Count; k++)
	{
		if ((actions[k].Type == GoTo) || (actions[k].Type == GoToR))
		{
			PDFXEdit.IPXC_Action_Goto actionGoTo = (PDFXEdit.IPXC_Action_Goto)actions[k];
			if (actionGoTo.IsValid == false)
			{
				invalidCount++;
			}
			else if (actions[k].Type == GoToR)
			{
				PDFXEdit.IPXC_FileSpec path = actionGoTo.Target;
				if (File.Exists(path.DIPath) == false)
					invalidCount++;
			}

		}
		else if (actions[k].Type == Launch)
		{
			PDFXEdit.IPXC_Action_Launch actionLaunch = (PDFXEdit.IPXC_Action_Launch)actions[k];
			if (actionLaunch.IsValid == false)
			{
				invalidCount++;
			}
			else
			{
				PDFXEdit.IPXC_FileSpec path = actionLaunch.FileSpec;
				if (path == null)
				{
					if (File.Exists(actionLaunch.FileName) == false)
						invalidCount++;
				}
				else
				{
					if (File.Exists(path.DIPath) == false)
						invalidCount++;
				}

			}
		}
	}
	return (invalidCount > 0);
}

See Also

IPXC_Annotation