# Disable Printer Icon until User applies filter

**URL:** <https://www.epiusers.help/t/disable-printer-icon-until-user-applies-filter/56567>\
**Category:** Epicor ERP 10\
**Tags:** e10\
**Created:** [June 7, 2019, 11:54am UTC](https://www.epiusers.help/t/disable-printer-icon-until-user-applies-filter/56567 "2019-06-07T11:54:39Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nancy\_Hoyt](https://www.epiusers.help/user_avatar/www.epiusers.help/nancy_hoyt/32/17746_2.png) [@Nancy\_Hoyt](https://www.epiusers.help/u/Nancy_Hoyt)\
**Post date:** [June 7, 2019, 11:54am UTC](https://www.epiusers.help/t/disable-printer-icon-until-user-applies-filter/56567/1 "2019-06-07T11:54:39Z")

</div>

Good Morning,

First off, WTH Epicor doesn’t make it less likely for users to NOT print the entire company’s BOMs is beyond my comprehension. Ok, gripe over…

We have a few reports, BOMs particularly that require a filter before user goes to print. It has recently come to our attention that the customization setting .Enabled = False on the PrintTool is not working. (Came to attention after user accidentally printed 900 pages of BOMs before being told by coworker that he was hogging the printer! ☹)

What’s really strange about it is that the PrintPreviewTool and GenerateTool are disabled as expected but not the PrintTool. Looking into the code available tools I saw additional PrintServerTool and PrintClientTool, but they don’t disable them either. As a matter of fact they don’t even exist during the code run.

I really hate to have to redo the whole way we do this. Any suggestions on how to make this work?

Thanks!  
Nancy

 ![image](https://epiusers.help/uploads/default/original/3X/0/e/0ee95cade2c0328e60b87f9e58a80d7cd1b26453.png)

 ![image](https://epiusers.help/uploads/default/original/3X/1/f/1fa2f861658fc21ea0fc01f3350e3db954ce04ed.png)

---

<div class="post-metadata">

**Author:** ![dhewi](https://www.epiusers.help/user_avatar/www.epiusers.help/dhewi/32/14166_2.png) [@dhewi](https://www.epiusers.help/u/dhewi)\
**Post date:** [June 7, 2019, 12:08pm UTC](https://www.epiusers.help/t/disable-printer-icon-until-user-applies-filter/56567/2 "2019-06-07T12:08:21Z")

</div>

The obvious difference between the ones that disable and the one that doesn’t, is that the problem one is a dropdown. They behave a bit differently, and I suspect that’s the root of your troubles.

---

<div class="post-metadata">

**Author:** ![hmwillett](https://www.epiusers.help/user_avatar/www.epiusers.help/hmwillett/32/93207_2.png) [@hmwillett](https://www.epiusers.help/u/hmwillett)\
**Post date:** [June 7, 2019, 12:10pm UTC](https://www.epiusers.help/t/disable-printer-icon-until-user-applies-filter/56567/4 "2019-06-07T12:10:37Z")

</div>

I think you can disable to tool in the drop down via ClientPrintTool and SeverPrintTool, but you can do an AfterToolClick with a message box showing the key to find out for sure.

Otherwise, the way I have done it in the past is a check of the filter dataset when any of the tools are clicked and do an args.Cancel if empty.

---

<div class="post-metadata">

**Author:** ![Nancy\_Hoyt](https://www.epiusers.help/user_avatar/www.epiusers.help/nancy_hoyt/32/17746_2.png) [@Nancy\_Hoyt](https://www.epiusers.help/u/Nancy_Hoyt)\
**Post date:** [June 7, 2019, 3:02pm UTC](https://www.epiusers.help/t/disable-printer-icon-until-user-applies-filter/56567/5 "2019-06-07T15:02:37Z")

</div>

Thanks for your replies.

I used msgbox to get the name of the tool and they are PrintPreviewTool and PrintClientTool. Doing the normal .enabled = false doesn’t work.

I think Daryl is right in that it behaves differently for this drop down. I suspect we will need to go your way Aaron, with new means of checking for filter upon tool click instead.

Nancy

---

<div class="post-metadata">

**Author:** ![utaylor](https://www.epiusers.help/user_avatar/www.epiusers.help/utaylor/32/64664_2.png) [@utaylor](https://www.epiusers.help/u/utaylor)\
**Post date:** [June 7, 2019, 8:10pm UTC](https://www.epiusers.help/t/disable-printer-icon-until-user-applies-filter/56567/6 "2019-06-07T20:10:50Z")

</div>

I’ve done a before click event that cancels the event when there is not a value in one of my baq report filters. You might be able to do the same thing…

---

<div class="post-metadata">

**Author:** ![utaylor](https://www.epiusers.help/user_avatar/www.epiusers.help/utaylor/32/64664_2.png) [@utaylor](https://www.epiusers.help/u/utaylor)\
**Post date:** [June 7, 2019, 8:14pm UTC](https://www.epiusers.help/t/disable-printer-icon-until-user-applies-filter/56567/7 "2019-06-07T20:14:43Z")

</div>

```
private void BAQReportForm_BeforeToolClick(object sender, Ice.Lib.Framework.BeforeToolClickEventArgs args)
	{
				//EpiMessageBox.Show(args.Tool.Key);
		/*INSERT IF STATEMENTS HERE the arg.Tool.Key is the tool that was clicked. you can check the value of your filter and then if it is blank you can write: throw new UIException("YOUR MESSAGE HERE.") */

	}
```

---

<div class="post-metadata">

**Author:** ![hkeric.wci](https://www.epiusers.help/user_avatar/www.epiusers.help/hkeric.wci/32/52019_2.png) [@hkeric.wci](https://www.epiusers.help/u/hkeric.wci)\
**Post date:** [June 8, 2019, 6:59pm UTC](https://www.epiusers.help/t/disable-printer-icon-until-user-applies-filter/56567/8 "2019-06-08T18:59:51Z")

</div>

There are a few ways you can do it, but just like @utaylor on a Report I kept it simple and just did like he did.

```cs
private void BAQReportForm_BeforeToolClick(object sender, Ice.Lib.Framework.BeforeToolClickEventArgs args)
{
	switch (args.Tool.Key)
	{
		case "PrintClientTool":
		case "PrintServerTool":
		case "PrintPreviewTool":
			// Build whereClause so we can inspect it
			string whereClause = this.buildBatchesWhereClause();

			if (whereClause == string.Empty)
			{
				args.Handled = true;
				EpiMessageBox.Show("You Must Select Filters, Unable to Print Wide Open.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}

			if (args.Tool.Key != "PrintPreviewTool" && this.IsWatermarkEnabled())
			{
				args.Handled = true;
				EpiMessageBox.Show("Something...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			break;
	}

}

```

The other way is to do it on EpiViewNotification and always apply the Enabled/Disabled to the Tool

---

<div class="post-metadata">

**Author:** ![utaylor](https://www.epiusers.help/user_avatar/www.epiusers.help/utaylor/32/64664_2.png) [@utaylor](https://www.epiusers.help/u/utaylor)\
**Post date:** [June 10, 2019, 12:16pm UTC](https://www.epiusers.help/t/disable-printer-icon-until-user-applies-filter/56567/9 "2019-06-10T12:16:26Z")

</div>

I believe I got the idea from you or someone else on the forum. It seems to work pretty well!

---

<div class="post-metadata">

**Author:** ![jgiese.wci](https://www.epiusers.help/user_avatar/www.epiusers.help/jgiese.wci/32/51553_2.png) [@jgiese.wci](https://www.epiusers.help/u/jgiese.wci)\
**Post date:** [June 10, 2019, 3:33pm UTC](https://www.epiusers.help/t/disable-printer-icon-until-user-applies-filter/56567/10 "2019-06-10T15:33:14Z")

</div>

> [@Nancy\_Hoyt](#):
>
> they are PrintPreviewTool and PrintClientTool. Doing the normal .enabled = false doesn’t work.

Sometimes with the toolbar icons you enter a race condition with something Epicor is doing in their logic. Typically your initialize code that would disable it fires, then a binding of some sorts of theirs after the data views become available enables them again leaving you sad.
