I am modifying Epicors RMA Process Form. I want to use the functionality they already have built in which in on a field leave it will get the new customer. I have the code to populate the boxes and all of that but I have to use separate buttons to keep the process flowing. I have to manually tab out of the box and then click another button to restart the process. Is there a way to send a tab key button press so the cursor leaves the field and performs the built in functions on a field leave?
private static void epiButtonC2_Click(object sender, System.EventArgs args)
{
txtCustomerCustID.EpiBinding = "";
epiButtonC2.Visible = false;
btnContinueNonCon.Visible = true;
txtCustomerCustID.Visible = true;
txtCustomerName.Visible = true;
txtCustomerCustID.Text = tbCustIDRef.Text;
txtCustomerCustID.EpiBinding = "RMAHead.CustomerCustID";
txtCustomerCustID.Focus();
//Would like a tab here and then I could go right into the next.
//oTrans.GetNewRMADtl();
//txtOrderNum.EpiBinding = "";
//txtOrderNum.Focus();
}
Remember, in the Epicor UI Epicor codes to Data Events and Data Properties (Extended Props) and does not code to control events or control properties.
To mimic the Epicor UI coded behaviors you need to hook the Data Change events - Changing (can cancel the data change) and Changed (the data has been changed).
Wherever possible do not code to Control Events or Control Properties.
So the only reason I was messing with the control was because when I launch the form the field attached to the Data View won’t accept a parameter I pass. I can pass it into a text box that isn’t bound. Is there a way I can just have that field accept a parameter passed in on load?
Just curious … Why did the following “work”?
Customized the Part Maint form to set the Alt PartNum upon clicking a button. The button click set the alt partnum field, and would give it focus, then take take away focus, and the Alt Part Desc would update as if I had tabbed out of the Alt PartNum field:
Did you run a trace? There are some methods that are called when a field changes (for example in the transfer inventory screen when changing bin locations, there is a server method that looks up the qty on hand). So something when leaving fields, there is some interaction with the server. I would bet that on that field, it’s something similar. It should show up in a trace.
I was going to respond to you (@Banderson) to say that the OP (@skearney) was trying to do something that did run some server side “stuff”.
But in the interest of best practices (and to remain in @josecgomez’s good graces) how should the OP’s task be done using the DataView and not the UI control?
What do you mean launch the form? Can you give us some insights as to the end goal? It appears form the code you shared you are just filling out a textbox from another textbox. What do you mean by Launch the form @skearney
So when you are changing the control, the control is changing the data view, it is triggered when you leave the field. So if you skip the field and go right to the dataview, you should be able to change the dataview directly, then run a notify to notify that it changed. Basically changing the focus is like turning your car right to turn the turn signal off, going to the dataview is like just turning off the turn signal.
something like this (warning, untested code to follow)
EpiDataView testView = (EpiDataView)(oTrans.EpiDataViews["RMAHead"]);//gets your data view
String testCustID = (string)testView.dataView[testView.Row]["CustomerCustID"];//get's the current custID, can skip really
testView.dataView[testView.Row]["CustomerCustID"] = "your value here";//sets the value new value of the customer ID
testView.dataView[testView.Row]["RowMod"]="U"; // sets the row mod so that it knows it's upated
testView.Notify(new EpiNotifyArgs(oTrans, testView.Row , testView.Column)); //triggers the change so it goes to the server to do the work.
So if you can do that instead of the focus changing thing.
(and credit goes to @josecgomez for the notify on the last line. I was going to use notify all and he pointed out that was overkill)