Trying to trigger an event off a data view column losing focus when the field has not changed

Hello.
I have some code that creates a new PerCon if after entering the FirstName, LastName, DOB. This code currently triggers off the OrderDtl_AfterFieldChange event but we need the to wait until the custom field EmpNum has been populated.

Unfortunately, a large portion of PerCons do not have an EmpNum, thus the AfterFieldChange does not trigger.

I’m trying to use the edvOrderDtl_EpiViewNotification but it only seems to trigger during the initialization and not when entering/leaving a column.

Thank you in advance for your time and effort.

EpiViewNotifications are fired as the result of a “Data” event and are fired to notify the controls bound to the DataView that they may need to “refresh” their display.

The Epicor UI internals and Epicor UI code is “Data centric” and based on Data events and Data properties. There is very little Epicor code pertaining to Control events like Get or Lose focus (Handheld forms have some). Those events are available but there are very few UI Customization helpers for them as Control events do not match the Epicor UI programming model.

2 Likes

You can use Control.Validating or Control.Leave events to handle this situation. If these are native controls, you cant use the wizard, you’ll need to get a ref and create (and destroy) you own events.

Simple example:

//global
EpiTextBox myTextBox;
myTextBox.Validating += myValidation;
//initialize
myTextBox = (EpiTextBox)csm.GetNativeControlReference("theguidhere");

//destroy
myTextBox.Validating -= myValidation;
//code

private void MyValidation(object sender, 
 				CancelEventArgs e)
{
if(SomeCheckFails) e.Cancel = true; //forces you stay until you fix
}

@Chris_Conn

Do you need to destroy the EpiTextBox myTextBox;

No sir, it’s just a reference to the control on the form.