epiShape issues

This will not stay set to false…Ideas?? According to the checkbox, this should be hidden now…AND, when I open back the customization, it shows the false was reset to true. Oh, and I have it set to red, but shows up green…what am I missing???

image

image

Yeah visible doesn’t always work becuase epicor is using code to make it visible again. Tried and true way to make something go away… location -500,-500 :slight_smile:

2 Likes

Will it reappear when it’s true at that location?

it will but outside of any viewable area

Well, I’m wanting it to be like the credit hold epishape. How do I make that work?

I think just like buttons you can EpiBind it to OrderHed.DepositHoldShape and then you can use Row Rules, you have to explicitly type that binding out and pretend it exists.

Here are two Examples.

In this example I use a Row Rule but I have a UD Field.

private void CreateRowRuleShipDtlCustomerOwnedInventory_cEquals_false()
{
	// Description: hideCustomerOwnedInventory
	// **** begin autogenerated code ****
	RuleAction invisibleShipDtl_CustomerOwnedInventory_c = RuleAction.AddControlSettings(this.oTrans, "ShipDtl.CustomerOwnedInventory_c", SettingStyle.Invisible);
	RuleAction[] ruleActions = new RuleAction[] {
			invisibleShipDtl_CustomerOwnedInventory_c};
	// Create RowRule and add to the EpiDataView.
	RowRule rrCreateRowRuleShipDtlCustomerOwnedInventory_cEquals_false = new RowRule("ShipDtl.CustomerOwnedInventory_c", RuleCondition.Equals, false, ruleActions);
	((EpiDataView)(this.oTrans.EpiDataViews["ShipDtl"])).AddRowRule(rrCreateRowRuleShipDtlCustomerOwnedInventory_cEquals_false);
	// **** end autogenerated code ****
}

In this Example you will notice me using OrderHed.eshUnfirmedReleases with a custom Condition.

private void CreateRowRuleOrderRelFirmReleaseCustomCondition_false()
{
	// Description: UnfirmedReleases
	// **** begin autogenerated code ****
	RuleAction invisibleOrderHed_eshUnfirmedReleases = RuleAction.AddControlSettings(this.oTrans, "OrderHed.eshUnfirmedReleases", SettingStyle.Invisible);
	RuleAction[] ruleActions = new RuleAction[] {
			invisibleOrderHed_eshUnfirmedReleases};
	// Create RowRule and add to the EpiDataView.
	RowRule rrCreateRowRuleOrderRelFirmReleaseCustomCondition_false = new RowRule("OrderRel.FirmRelease", new RowRuleConditionDelegate2(this.OrderRelFirmReleasefalse_CustomRuleCondition), null, ruleActions);
	((EpiDataView)(this.oTrans.EpiDataViews["OrderHed"])).AddRowRule(rrCreateRowRuleOrderRelFirmReleaseCustomCondition_false);
	// **** end autogenerated code ****
}

private bool OrderRelFirmReleasefalse_CustomRuleCondition(Ice.Lib.ExtendedProps.RowRuleDelegateArgs args)
{
	EpiDataView edvOrderRel = this.oTrans.Factory("OrderRel");

	if (edvOrderRel.Row != -1 && edvOrderRel.dataView.Count > 0) {
		return !Convert.ToBoolean(edvOrderRel.dataView.Table.Select("FirmRelease = 0 AND OpenRelease = 1").Length > 0);
	}

	return true;
}

Basically use Row Rules with an imaginary binding :slight_smile:

I think @Rich can confirm that Epicor’s Framework handles Buttons and Shapes differently, they get a pass but still can make use of Binding to Manage their states, visibility, colors what not.

That’s what I’ve been doing, replicating what Epicor does on other Shapes and Buttons.

3 Likes

You have to remember that the Epicor Smart Client UI controls are “data-centric”. If you want a control to be red, you color the data red. If you want a control to not be visible, you make the data not visible.

This was done intentionally as the same piece of data can appear in multiple locations on the UI - Grid, Detail Sheet, Custom added UI Control - and we didn’t want you or the Epicor coders having to configure / manage (and find) all the UI controls displaying a data element.

As Haso says, the Button and Shape controls support non-existent Bindings so we could use Row Rules to manage them independent of actual data elements. The Row Rule Wizard doesn’t know about the fictitious bindings so you will need to use the wizard to create the base code and then manually edit the code to reference your fake binding name. @hasokeric examples are a good reference for that.

2 Likes

@hasokeric @Rich

Ok, so the code I used does hide the checkbox02. HOWEVER, the checkbox itself is on the Header Tab and also becomes invisible. LOL! So, how do I make the epiShape invisible but allow the checkbox to remain visible to change accordingly.

Use Haso’s example and create a fake binding and manage that via Row Rules that you modify to reference the fake binding.

1 Like

Maybe there’s an easier way but I use EpiViewNotification.Initialize and set the Visible and Status properties of the EpiShape manually. I don’t have the EpiShape bound to any fields. Something like:

if (condition)
{
  // set shapes backcolor to red
  epiShapeC1.Status = (Ice.Lib.Framework.StatusTypes)2;
  epiShapeC2.Status = (Ice.Lib.Framework.StatusTypes)2;
  
  // show shape
  epiShapeC1.Visible=true;
}

Should be very simple your Checkbox gets OrderHed.CheckBox01 your Shape gets OrderHed.eshCheckBox01 lets say that and then a simple row rule

Example of me using NoBoundField, but same concept I have an actual checkbox and when that checkbox is false I set the Shape to Disabled or you can change colors in a Custom Action.

private void CreateRowRuleNoBoundFieldeshCustomerOwnedInventoryEquals_false()
{
	// Description: CustomerOwnedInvShapeColor
	// **** begin autogenerated code ****
	RuleAction disabledNoBoundField_eshCustomerOwnedInventory = RuleAction.AddControlSettings(this.oTrans, "NoBoundField.eshCustomerOwnedInventory", SettingStyle.Disabled);
	RuleAction[] ruleActions = new RuleAction[] {
			disabledNoBoundField_eshCustomerOwnedInventory};
	// Create RowRule and add to the EpiDataView.
	RowRule rrCreateRowRuleNoBoundFieldeshCustomerOwnedInventoryEquals_false = new RowRule("OrderDtl.CustomerOwnedInventory_c", RuleCondition.NotEqual, true, ruleActions);
	((EpiDataView)(this.oTrans.EpiDataViews["NoBoundField"])).AddRowRule(rrCreateRowRuleNoBoundFieldeshCustomerOwnedInventoryEquals_false);
	// **** end autogenerated code ****
}

All of this is Wizard Generated code, you can do it all through the Wizard.

I took the code for the noboundfield and did this to it…does it look correct?

private void CreateRowRuleOrderHedCheckBox02Equals_false()
{
// Description: OrderHedCheckBox02
// **** begin autogenerated code ****
RuleAction disabledNoBoundField_eshCheckBox02 = RuleAction.AddControlSettings(this.oTrans, “NoBoundField.eshCheckBox02”, SettingStyle.Disabled);
RuleAction[] ruleActions = new RuleAction[] {
disabledNoBoundField_eshCheckBox02};
// Create RowRule and add to the EpiDataView.
RowRule rrCreateRowRuleNoBoundFieldeshOrderHedCheckBox02_false = new RowRule(“OrderHed.Checkbox02”, RuleCondition.NotEqual, true, ruleActions);
((EpiDataView)(this.oTrans.EpiDataViews[“NoBoundField”])).AddRowRule(rrCreateRowRuleNoBoundFieldeshOrderHedCheckBox02_false);
// **** end autogenerated code ****
}

@hasokeric

Making headway here. I am still learning a lot about this, and appreciate your help. I am getting an error when testing the code. Note: I tried doing this via the wizard and I couldn’t type in the epibinding, it had to be selected from the list. So, I am trying to use your example and code this in.


 Error: CS1061 - line 564 (3994) - 'Script' does not contain a definition for 'OrderHedCheckBox02false_CustomRuleCondition' and no extension method 'OrderHedCheckBox02false_CustomRuleCondition' accepting a first argument of type 'Script' could be found (are you missing a using directive or an assembly reference?)

My code is:  

```	private void CreateRowRuleOrderHedCheckBox02_false()
{
	// Description: CheckBox02
	// **** begin autogenerated code ****
	RuleAction invisibleOrderHed_eshDepositHold = RuleAction.AddControlSettings(this.oTrans, "OrderHed.eshDepositHold", SettingStyle.Invisible);
	RuleAction[] ruleActions = new RuleAction[] {
			invisibleOrderHed_eshDepositHold};
	// Create RowRule and add to the EpiDataView.
	RowRule rrCreateRowRuleOrderHedCheckBox02_false = new RowRule("OrderHed.CheckBox02", new RowRuleConditionDelegate2(this.OrderHedCheckBox02false_CustomRuleCondition), null, ruleActions);
	((EpiDataView)(this.oTrans.EpiDataViews["OrderHed"])).AddRowRule(rrCreateRowRuleOrderHedCheckBox02_false);
	// **** end autogenerated code ****
}

Checkout this related post it may help get you across the finish line,

1 Like

All this time…GEEZ I feel stupid!!! @josecgomez Thank you for the video. Helped tremendously!

1 Like

I am glad you stuck through it and followed the Best Practice rather than let’s just get it to work. Jose’s Video is more visual and thats exactly it! Good Gist Video Jose!

Row Rules will convert to Kinetic easier.

1 Like