public void Initialize() { // Menu to open Lookups form Dynamics.Forms.AboutBox.AddMenuHandler(OpenLookupWindow, "Lookups", ""); // Select button on the Customers lookup window Microsoft.Dexterity.Applications.SmartListDictionary.CustomerLookupForm customerLookupForm = SmartList.Forms.CustomerLookup; customerLookupForm.CustomerLookup.SelectButton.ClickBeforeOriginal += new System.ComponentModel.CancelEventHandler(CustomerSelectButton_ClickBeforeOriginal); // Select button on the Vendors lookup window Microsoft.Dexterity.Applications.SmartListDictionary.VendorLookupForm vendorLookupForm = SmartList.Forms.VendorLookup; vendorLookupForm.VendorLookup.SelectButton.ClickBeforeOriginal += new System.ComponentModel.CancelEventHandler(VendorSelectButton_ClickBeforeOriginal); // Select button on the Items lookup window Microsoft.Dexterity.Applications.SmartListDictionary.IvItemNumberLookupForm itemNumberLookupForm = SmartList.Forms.IvItemNumberLookup; itemNumberLookupForm.IvItemNumberLookup.SelectButton.ClickBeforeOriginal += new System.ComponentModel.CancelEventHandler(ItemSelectButton_ClickBeforeOriginal); // Select button on the GL Account lookup window Microsoft.Dexterity.Applications.SmartListDictionary.AccountLookupForm accountLookupForm = SmartList.Forms.AccountLookup; accountLookupForm.AccountLookup.SelectButton.ClickBeforeOriginal += new System.ComponentModel.CancelEventHandler(AccountSelectButton_ClickBeforeOriginal); // Select button on the SOP Document lookup window Microsoft.Dexterity.Applications.SmartListDictionary.SopDocumentLookupForm sopLookupForm = SmartList.Forms.SopDocumentLookup; sopLookupForm.SopDocumentLookup.SelectButton.ClickBeforeOriginal += new System.ComponentModel.CancelEventHandler(SOPDocumentSelectButton_ClickBeforeOriginal); // Select button on the POP Document lookup window Microsoft.Dexterity.Applications.SmartListDictionary.PopDocumentLookupForm popLookupForm = SmartList.Forms.PopDocumentLookup; popLookupForm.PopDocumentLookup.SelectButton.ClickBeforeOriginal += new System.ComponentModel.CancelEventHandler(POPDocumentSelectButton_ClickBeforeOriginal); // Validate script that prevents the POP Document lookup window from being displayed popLookupForm.PopDocumentLookup.PopPoLookup.ValidateBeforeOriginal += new System.ComponentModel.CancelEventHandler(PopPoLookup_ValidateBeforeOriginal); }
void ItemSelectButton_ClickBeforeOriginal(object sender, System.ComponentModel.CancelEventArgs e) { // Run this code only if the Visual Studio Tools add-in opened the lookup. if (GPAddIn.ReturnToLookup == true) { // Retrieve the item number of the row selected in the scrolling window // of the Items lookup. Microsoft.Dexterity.Applications.SmartListDictionary.IvItemNumberLookupForm itemLookupForm = SmartList.Forms.IvItemNumberLookup; string itemNumber = itemLookupForm.IvItemNumberLookup.IvItemNumberScroll.ItemNumber; // Display the value retrieved LookupsWindow.ItemNumber.Text = itemNumber; // Clear the flag that indicates a value is to be retrieved from the lookup. GPAddIn.ReturnToLookup = false; } }
private void ItemLookup_Click(object sender, EventArgs e) { // Create a reference to the IvItemNumberLookup form Microsoft.Dexterity.Applications.SmartListDictionary.IvItemNumberLookupForm itemNumberLookup = SmartList.Forms.IvItemNumberLookup; // Set the flag indicating that we opened the lookup GPAddIn.ReturnToLookup = true; // Open the lookup form. itemNumberLookup.Open(); // Set the field values on the lookup window // The options for the sort by value are: // 1 = Item Number // 2 = Item Description // 3 = Item Class Code // 4 = Item Short Name //itemNumberLookup.IvItemNumberLookup.AsiLuViewButton.Value = 1; //itemNumberLookup.IvItemNumberLookup.AsiEndDdl1.Value = 2; //itemNumberLookup.IvItemNumberLookup.AsiLuColumnButtonDropList.Value = 3; // Value = "string"; //itemNumberLookup.IvItemNumberLookup.LocalCheckedView.Value = 2; //itemNumberLookup.IvItemNumberLookup. // Sort by the item number //itemNumberLookup.IvItemNumberLookup.SortByIvItems.Value = 3; // For the sort option chosen, set the corresponding field value /*switch (itemNumberLookup.IvItemNumberLookup.SortByIvItems.Value) * { * case 1: * //Item Number * itemNumberLookup.IvItemNumberLookup.ItemNumber.Value = ItemNumber.Text; * break; * * case 2: * // If sorting based on Item Description, you will set that value here * itemNumberLookup.IvItemNumberLookup.ItemDescription.Value = ItemNumber.Text; * break; * * case 3: * // If sorting based on Item Class Code, you will set that value here * itemNumberLookup.IvItemNumberLookup.ItemClassCode.Value = ItemNumber.Text; * break; * * case 4: * // If sorting based on Item Short Name, you will set that value here * itemNumberLookup.IvItemNumberLookup.ItemShortName.Value = ItemNumber.Text; * break; * }*/ //Run Validate on the Redisplay button to fill the lookup window //itemNumberLookup.Tables.AsiLuDefaultViews.FormName.Value = //AsiAdditionalSort.Value = 4; itemNumberLookup.Tables.AsiLuDefaultViews.DefaultView.Value = 4; itemNumberLookup.IvItemNumberLookup.IvItemNumberScroll.LocationCode.Value = "IQ27"; itemNumberLookup.Tables.AsiLuDefaultViews.AsiFavoriteType.Value = 4; itemNumberLookup.IvItemNumberLookup.AsiLuViewButton.Value = 4; itemNumberLookup.IvItemNumberLookup.AsiLuViewButton.Hide(); //itemNumberLookup.IvItemNumberLookup.scroll //((Microsoft.Dexterity.Bridge.FieldReadWrite<string>)(itemNumberLookup.IvItemNumberLookup.AsiLuCurrentView)).Value //itemNumberLookup.IvItemNumberLookup.AsiLuCurrentView.Show(); itemNumberLookup.IvItemNumberLookup.RedisplayButton.RunValidate(); itemNumberLookup.IvItemNumberLookup.AsiLuFindString.Value = "Hello"; itemNumberLookup.IvItemNumberLookup.AsiLuFindString.Focus(); }