IPX Control Commands Sample Without Menu
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
IPX Control Commands Sample Without Menu
Hey Folks –
Is there a sample project that provides all of the major IPX functionality using code only? For example, I want to add an acroform field programmatically using the UI with mouse up/down events without using the IPX menu. Step 1: put the mouse into draw mode, Step 2: capture a region based on mouse down/up, Step 3: draw the corresponding selected acroform field. I have found numerous examples of Step #3, but I am not finding the example code for #1 and #2.
I would really like to see the same sample code for all of the basic menu item functionality like adding notes, draw objects, etc. that is used from the menu. Essentially, I really want to recreate the current IPX menu with my own code as I currently have my own menu controls that I want to use but I cannot find the standalone sample code to recreate the coding. I completely understand that showing all the code might be a headache but I am struggling to find the individual code snippets of Steps #1-#2-#3 for most all of the menu functions.
Again, I am only referencing simple stuff like: overlay management, select text, select regions, select comments, snapshot, add text, add image, highlight, line, pencil, distance, add sticky notes, copy, paste, ... you know ... simple stuff but all programmatically starting with the mouse down/up events to the method/event itself with the return object (if any). I have been reading the online help and it is hit or miss on finding code snippets.
So… all of this is probably me missing an obvious, but I would rather accept your internal mocking than me keep hitting my head on the wall for missing the obvious… my head is starting to hurt …
I have all of the GitHub sample code … but … what am I missing?
-Eric
Is there a sample project that provides all of the major IPX functionality using code only? For example, I want to add an acroform field programmatically using the UI with mouse up/down events without using the IPX menu. Step 1: put the mouse into draw mode, Step 2: capture a region based on mouse down/up, Step 3: draw the corresponding selected acroform field. I have found numerous examples of Step #3, but I am not finding the example code for #1 and #2.
I would really like to see the same sample code for all of the basic menu item functionality like adding notes, draw objects, etc. that is used from the menu. Essentially, I really want to recreate the current IPX menu with my own code as I currently have my own menu controls that I want to use but I cannot find the standalone sample code to recreate the coding. I completely understand that showing all the code might be a headache but I am struggling to find the individual code snippets of Steps #1-#2-#3 for most all of the menu functions.
Again, I am only referencing simple stuff like: overlay management, select text, select regions, select comments, snapshot, add text, add image, highlight, line, pencil, distance, add sticky notes, copy, paste, ... you know ... simple stuff but all programmatically starting with the mouse down/up events to the method/event itself with the return object (if any). I have been reading the online help and it is hit or miss on finding code snippets.
So… all of this is probably me missing an obvious, but I would rather accept your internal mocking than me keep hitting my head on the wall for missing the obvious… my head is starting to hurt …
I have all of the GitHub sample code … but … what am I missing?
-Eric
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: IPX Control Commands Sample Without Menu
Seems to be easy... You just need:Step 1: put the mouse into draw mode, Step 2: capture a region based on mouse down/up, Step 3: draw the corresponding selected acroform field. I have found numerous examples of Step #3, but I am not finding the example code for #1 and #2.
1. Open any document (as a user or via code). The document must have permission to add/edit form fields.
2. Activate a special tool for adding the corresponding type of form-filed via running the corresponding command:
pdfCtl.Inst.ExecUICmd("cmd.tool.editFields.mode.text");
- after this user will be able to use mouse/finger to create new text fields on the pages. Other commands for form-field creation tool(s) are:
cmd.tool.editFields.mode.text
cmd.tool.editFields.mode.check
cmd.tool.editFields.mode.radio
cmd.tool.editFields.mode.list
cmd.tool.editFields.mode.combo
cmd.tool.editFields.mode.button
cmd.tool.editFields.mode.signature
cmd.tool.editFields.mode.barcode
cmd.tool.editFields.mode.date
cmd.tool.editFields.mode.image
However, if you already handle mouse_down->mouse_move... mouse_up sequence of events and want to add via code the certain form field on mouse_up, then:
form = pdfCtl.Doc.CoreDoc.AcroForm;
IPXC_FormField field = form.CreateField("Text1", PXC_FormFieldType.FFT_Text, pageIndex, rectOnPage);
field.SetValueText("Sample Text");
// redraw corresponding page's region after adding new form field there:
pdfCtl.Doc.InvalidatePageRects(pageIndex, rectOnPage, 1);
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Re: IPX Control Commands Sample Without Menu
Thank you Vasyl! I am getting stuck on simply creating the rectangle draw on the viewer. Super simple stuff like how to put the control into a select or draw mode (like what happens after I choose "edit text" or "insert text"). I want to recreate what your menu commands do from scratch (i.e. I want to put the viewer into edit/insert mode programmatically). The Tracker menu is freaking awesome, but there are several menu commands that I need granular control to display my own interfaces. That means I have to learn how to recreate all of your menu commands using my own code... which is why I want to see your code ... because I "don't" have that mouse down/up code that you guys are using
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: IPX Control Commands Sample Without Menu
In the sample, we provided you - you may see the one important string:
doc.ActivateTool(MarkupTool.ID);
- this code enables your custom tool to listen all UI-events from the PagesView window. And to disable it for your tool(==listener) you need to click any other tool on the Editor' toolbar, for example - 'Hand' tool. Or run it:
doc.ActivateTool(pdfCtl.Inst.Str2ID("tool.hand"));
===
To add your own item to existing Editor's toolbar (C#):
And result of it:
HTH
doc.ActivateTool(MarkupTool.ID);
- this code enables your custom tool to listen all UI-events from the PagesView window. And to disable it for your tool(==listener) you need to click any other tool on the Editor' toolbar, for example - 'Hand' tool. Or run it:
doc.ActivateTool(pdfCtl.Inst.Str2ID("tool.hand"));
===
To add your own item to existing Editor's toolbar (C#):
Code: Select all
public partial class MyCmdHandler : PDFXEdit.IUIX_CmdHandler
{
MainFrm frm = null;
public MyCmdHandler(MainFrm f) { frm = f; }
public void OnCreateNewCtl(PDFXEdit.IUIX_Cmd pCmd, PDFXEdit.IUIX_CmdBar pParent, out PDFXEdit.IUIX_Obj pCtl)
{
pCtl = null;
}
public void OnGetCtlSizes(PDFXEdit.IUIX_CmdItem pItem, ref PDFXEdit.tagSIZE nSize, ref PDFXEdit.tagSIZE nMinSize, ref PDFXEdit.tagSIZE nMaxSize)
{ }
public void OnGetItemSubMenu(PDFXEdit.IUIX_CmdItem pItem, out PDFXEdit.IUIX_CmdMenu pSubMenu)
{
pSubMenu = null;
}
public void OnDrawItemIcon(PDFXEdit.IUIX_RenderContext pRC, PDFXEdit.IUIX_CmdItem pItem, ref PDFXEdit.tagRECT stIconRect, ref PDFXEdit.tagRECT stClip)
{ }
public void OnGetItemState(PDFXEdit.IUIX_Cmd pCmd, PDFXEdit.IUIX_CmdItem pItem, PDFXEdit.IUIX_Obj pOwner, out int nState)
{
PDFXEdit.IPXV_Document doc = frm.pdfCtl.Doc;
if (doc == null)
{
nState = (int)PDFXEdit.UIX_CmdItemState.UIX_CmdItemState_Disabled;
return;
}
nState = doc.ActiveTool == frm.MarkupTool ? (int)PDFXEdit.UIX_CmdItemState.UIX_CmdItemState_Checked : (int)PDFXEdit.UIX_CmdItemState.UIX_CmdItemState_Normal;
}
public void OnNotify(int nCode, PDFXEdit.IUIX_Cmd pCmd, PDFXEdit.IUIX_CmdItem pItem, PDFXEdit.IUIX_Obj pOwner, uint nNotifyData)
{
if (nCode == (int)PDFXEdit.UIX_CmdNotifyCodes.UIX_CmdNotify_Exec)
{
PDFXEdit.IPXV_Document doc = frm.pdfCtl.Doc;
if (doc != null)
{
// toggle
if (doc.ActiveTool != frm.MarkupTool)
doc.ActivateTool(frm.MarkupTool.ID);
else
doc.ActivateTool(frm.pdfCtl.Inst.Str2ID("tool.hand"));
}
}
}
}
....
PDFXEdit.IUIX_Cmd cmd = uiInst.CmdManager.Cmds.AddNew("myUniqueCmdID", "", new MyCmdHandler(this));
cmd.Icon = uiInst.GetIcon("cmd.annot.redact.toRect");
cmd.Title = "My Custom Tool";
cmd.Tip = "My Custom Tool Tip";
PDFXEdit.IUIX_CmdBar bar = uiInst.CmdManager.GetFirstCmdBar(pdfCtl.Inst.Str2ID("cmdbar.file"));
bar.InsertItem(cmd, -1, 0, 0, -1);
HTH
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: IPX Control Commands Sample Without Menu
Hi Vasyl,
-žarko
I'm also interested in the "custom tool" sample ...In the sample, we provided you...
-žarko
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: IPX Control Commands Sample Without Menu
Here it is:
And Note for Lambchop: this attached sample project has fixed one bug with redrawing custom regions. Also we slightly improved the corresponding UI. So for you is better to use this new one...
And Note for Lambchop: this attached sample project has fixed one bug with redrawing custom regions. Also we slightly improved the corresponding UI. So for you is better to use this new one...
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: IPX Control Commands Sample Without Menu
Thanks Vasyl.
-ž
-ž
- Tracker Supp-Stefan
- Site Admin
- Posts: 17910
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: IPX Control Commands Sample Without Menu
I can only get my code to work using the Tracker menu, I cannot get a custom menu to work correctly. So just confirming ... there is no way for me to create my own menu? I am forced to you use the Tracker menu for everything?
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: IPX Control Commands Sample Without Menu
Well, you may hide all tracker's toolbars and add your own toolbar instead, via:
HTH
Code: Select all
// hide all standard toolbars above the pages view
{
PDFXEdit.IUIX_Obj cmdPaneObj = pdfCtl.Inst.ActiveMainView.CmdPaneTop.Obj;
PDFXEdit.IUIX_CmdManager cmdMan = uiInst.CmdManager;
uint cmdBarsCnt = cmdMan.CmdBarsCount;
for (uint i = 0; i < cmdBarsCnt; i++) {
PDFXEdit.IUIX_CmdBar cbar = cmdMan.CmdBar[(int)i];
if (cbar.Obj.IsChildOf(cmdPaneObj))
cbar.Hide();
}
}
// add own toobar instead of them
{
PDFXEdit.tagRECT rc;
rc.left = rc.right = rc.top = rc.bottom = 0;
PDFXEdit.IUIX_CmdBar bar = uiInst.CreateCmdBar(pdfCtl.Inst.ActiveMainView.Obj, rc, "myCmdBar", "My Toolbar");
pdfCtl.Inst.ActiveMainView.CmdPaneTop.InsertBar(bar, -1, -1, true);
// add own commands to this custom toolbar. Also here you may add any standard cmd too...
}
// to show all cmdPanes (hidden by default)
pdfCtl.VisibleCmdPanes = (uint)PDFXEdit.PXV_VisibleCmdPanes.PXV_VisibleCmdPanes_All;
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.