Updating a HUD through the API
Posted: Thu May 30, 2013 5:53 pm
I am trying to utilize the SoftPro API to update the HUD, but I am having trouble getting certain lines, and within those lines, certain fields updated with new data.
My setup is like this: I have an editable grid within a windows form that reads the existing HUD through the API, and allows users to make changes to the description, bill code, GFE, and multiple other fields. When the user clicks a button to update, the code reads through the existing SoftPro HUD, finds the line number that corresponds to the line number on the grid, and then tries to repopulate each field within the line with whatever data the user entered.
However, I can’t find any consistency to which fields are updatable and which are not via the API. I’ve checked the SDK documentation and cannot find any clues as to what I should be doing. I've attached an image of a snippet of the code I'm using.
I have tried updating an existing order in the system, as well as create a brand new order from scratch and updating that HUD. With the existing order, I attached Select to the Visual Studio debugger to see what was happening. When I step through lines 140-146 of the snippet that set the Description and Buyer Amount on line 207, the changes don’t get set. I then tried line 506, and in that case, it let me update the description successfully.
I realize there is a lot of validation going on behind the scenes, and for the most part, the code throws exceptions if I try to update something that I wouldn’t be able to through the GUI. However, in the cases above, I can update through the GUI, but not through the API.
For reference, we’re accessing the open order in Select through the following method.
/// <summary>
/// If an order is open and active in select, return it. Otherwise return null.
/// </summary>
private IOrder GetActiveOrder()
{
IWindowManager windowManager = GetService<IWindowManager>();
IWindowFrame activeDocument = windowManager.ActiveDocument;
IRunningDocumentsManager runningDocumentsManager;
IRunningDocumentInformation runningDocumentInformation;
EditorPane p;
if (!Common.HasValue(activeDocument)) return null;
runningDocumentsManager = GetService<IRunningDocumentsManager>();
runningDocumentInformation =runningDocumentsManager.FindDocument(activeDocument.DocumentHandle);
if (!Common.HasValue(runningDocumentInformation)) return null;
p = runningDocumentInformation.Data as EditorPane;
if (!Common.HasValue(p)) return null;
// Return the order.
return p.GetProperty("Order") as IOrder;
}
My setup is like this: I have an editable grid within a windows form that reads the existing HUD through the API, and allows users to make changes to the description, bill code, GFE, and multiple other fields. When the user clicks a button to update, the code reads through the existing SoftPro HUD, finds the line number that corresponds to the line number on the grid, and then tries to repopulate each field within the line with whatever data the user entered.
However, I can’t find any consistency to which fields are updatable and which are not via the API. I’ve checked the SDK documentation and cannot find any clues as to what I should be doing. I've attached an image of a snippet of the code I'm using.
I have tried updating an existing order in the system, as well as create a brand new order from scratch and updating that HUD. With the existing order, I attached Select to the Visual Studio debugger to see what was happening. When I step through lines 140-146 of the snippet that set the Description and Buyer Amount on line 207, the changes don’t get set. I then tried line 506, and in that case, it let me update the description successfully.
I realize there is a lot of validation going on behind the scenes, and for the most part, the code throws exceptions if I try to update something that I wouldn’t be able to through the GUI. However, in the cases above, I can update through the GUI, but not through the API.
For reference, we’re accessing the open order in Select through the following method.
/// <summary>
/// If an order is open and active in select, return it. Otherwise return null.
/// </summary>
private IOrder GetActiveOrder()
{
IWindowManager windowManager = GetService<IWindowManager>();
IWindowFrame activeDocument = windowManager.ActiveDocument;
IRunningDocumentsManager runningDocumentsManager;
IRunningDocumentInformation runningDocumentInformation;
EditorPane p;
if (!Common.HasValue(activeDocument)) return null;
runningDocumentsManager = GetService<IRunningDocumentsManager>();
runningDocumentInformation =runningDocumentsManager.FindDocument(activeDocument.DocumentHandle);
if (!Common.HasValue(runningDocumentInformation)) return null;
p = runningDocumentInformation.Data as EditorPane;
if (!Common.HasValue(p)) return null;
// Return the order.
return p.GetProperty("Order") as IOrder;
}