Warning Message on check box

We recently had an issue with in Part Maintenance where somehow “Generate PO Suggestions” check box was unchecked on a part that should be driving requirements. Is there a way to generate a pop up message when someone unchecks this box that asks the user if they really want to proceed? In most cases this clearing this check box would be a mistake. Or any other suggestions on how to solve this issue?

In my experience you don’t even have to check in the box to remove the check. You can click clear to the left of the box and it will check/uncheck. In our case I’m sure someone accidentally clicked and didn’t even realize they had done it.

Thanks in advance for your suggestions!

If you are interested, I have code to un link the labels on checkboxes so clicking near them does not change the state of the checkbox…

A BPM would do that. Just pop up a message box when the state of the check box changes. Downside is this would always happen; users might get irked at having to close the message box every time they change it intentionally as well as accidentally.

I would be interested in this code! Thank you!

We rarely change this specific check box - so probably wouldn’t be annoying to anyone. Thanks for the suggestion!

in the Initialize Custom Code block Call

ScanControls();
the code for that call:

private void ScanControls( System.Windows.Forms.Control.ControlCollection ctrls = null)
{
	if (ctrls == null)
	ctrls = oTrans.EpiBaseForm.Controls;

	foreach (Control ctl in ctrls)
	{
		if (ctl.HasChildren)
			ScanControls(ctl.Controls);
	
		if((ctl) is Ice.Lib.Framework.EpiCheckBox)
		{
			Ice.Lib.Framework.EpiCheckBox cb = (Ice.Lib.Framework.EpiCheckBox)ctl;
			cb.EpiLabel = null;
		}
	}		
}

If you wanted the pop-up to appear at the moment the unchecking happens, C# code would do it.

The Generate Suggestions CheckBox is probably still the Base CheckBox even if Part Entry has been Customized, so aliasing this with the GUID is iffy for me. Still haven’t got the hang of that with Event Wizard.

I’d just unlink the Label from the Base CheckBox, hide the Base CheckBox, and add a new one, placed in the same location as the Base CheckBox. Link the Base CheckBox Label to the new CheckBox. Name the new CheckBox epiCheckBoxGenSugg and set the EpiBinding to PartPlant.GenerateSugg ( which is what the Base CheckBox is bound to ), then Save the Customization so the new CheckBox will show up in the Event Wizard list.

In Event Wizard, add an Event for

  • EpiCheckBox
  • epiCheckBoxGenSugg
  • CheckStateChanged

Replace the line

// ** Place Event Handling Code Here **

with the if and else lines as below :

	private void epiCheckBoxGenSugg_CheckStateChanged( object sender, System.EventArgs args )
	{
			if ( epiCheckBoxPopUpTest.Checked ) {   }
			else {   System.Windows.Forms.MessageBox.Show( "Generate PO Suggestions has been UnChecked" );   }
	} //   end epiCheckBoxGenSugg_CheckStateChanged( )

Update All Event Code, Compile and Save. This should pop up a message only if that CheckBox is Checked and then is Unchecked.

I expect that aliasing the Base CheckBox with the GUID can be done, it’s just past my skill level ( and time to experiment with ) at this point :slight_smile:

Ken Brunelli