How to change color when checked

I am adding two UD check-boxes to Part. I would like for the box or its label to highlight when checked. I’ve used Rule Wizard in the past to highlight fields with specific values and that works great for EpiCombo drop-down fields but seems to have no impact on EpiCheckBox fields (nothing highlights).

Am I missing something obvious right in front of me or is this just not possible with a checkbox? I don’t get why the interface would allow me to set a Rule Action on a checkbox if it will never do anything anyway, that’s why I think I’m missing something here.

I’m not sure you have that level of control over those controls. Maybe if you disable App Styles on those you could overwrite some of the properties easier. I would use an EpiShape in a case like this if you have the real estate for it.

2 Likes

Whenever I add a check box I shrink it down to a size of 20x20. Any chance you do the same thing and if you make it bigger the “text” area of the check box highlights?

@jgiese.wci I haven’t been able to find any guides on EpiShape that I can even remotely understand. Most of them require custom code and I don’t know how to code. That’s why I am here using the rule Wizard, which seems to work for everything except check boxes.

@jkane This seemed like a great idea and I gave it a try (keeping the original size of the checkbox and text instead of shrinking it down to only the 20x20 checkbox) but unfortunately that didn’t have an impact either way. That extra space doesn’t change color per the rule.

I’m maybe getting close to something that could work. I have the checkbox, but then I also added a Text box with the same epiBinding as the checkbox. The text box shows True/False depending on if the box is checked, and it turns red per the rule wizard. This isn’t how I want it to look but maybe with a few more tips or creative ideas we can use this somehow.

Screen Shot 2022-08-05 at 3.28.36 PM

The shape is driven by enabled / disabled behavior and enabled / disabled caption.

So you can control this by binding the EpiShape to a CheckBox, when the CheckBox is Checked RowRule Disable

Then set an Enabled / Disabled Caption on the EpiShape.

That will give you 2 States of the EpiShape (Enabled Green / Disabled Gray)
EpIShape

There are ways to change its color too but that requires a bit of code. Which is pretty easy in the InitializeCustomCode set the Status Type of the Shape to one of these

/*
StatusTypes.Warning //Yellow

StatusTypes.Global //Blue

StatusTypes.OK //Green

StatusTypes.Stop //Red
*/ 
epiShapeC1.Status=StatusTypes.Stop;

image

3 Likes

@josecgomez I am able to replicate what you stated here, however… notice that when you check the box and it goes to DISABLED state, that then the checkbox itself is then disabled too and there is no way un-check the checkbox. It’s like a one-way function. The user should have a way to un-check that option just in case it is accidentally checked.

Overall for my particular use case, the lack of ability to un-check that box isn’t ALL bad since an Aerospace part is always going to be an Aerospace part (is that what you were thinking too?). But I’d like to know how to do this where it can be checked and unchecked as needed since there are other scenarios I can image where that will be very useful.

You can use 2 checkboxes one that drives the Shape and one that can bechecked and unchecked.

Rule CheckBox1 Checked Action Disable CheckBox2
Rule CheckBox1 UnChecked Action Enable CheckBox2

2Chk

You can also (specifically for EpiShapes) use a non existing CheckBox to drive the Shape. Let me throw something together about that.

Here’s the walk through using a non-existing binding to drive the EpiShape behavior.

Hope this helps.

1 Like

In your example, checking the box DISABLES the epiShape. But in my case I want the epiShape disabled until the box is checked. The point is to draw attention to the fact that the box is checked. Is that possible to do? If I create a rule to disable the checkbox when unchecked (its default state), then it is always disabled and always un-checkable. Though your 2-checkbox method would work around that.

“You can also (specifically for EpiShapes) use a non existing CheckBox to drive the Shape. Let me throw something together about that.”

That sounds interesting, I am curious about that because in this case I can’t re-use any existing checkboxes on this sheet, so that means I need 2 UD fields, one to hold the value and the other to trigger the shape.

I just posted that example above let me know if that works :slight_smile: (and I made it so that checked means enabled)

1 Like

@josecgomez This is brilliant, thank you. It works exactly as needed. And I’m sure that video is going to be super helpful to a lot of other people since that is a super non-obvious / hidden / unexpected feature! Thank you for doing that.

1 Like

Just trying to add some polish now that this works: does anyone know how to fully hide this border when the epiShape is disabled? The interface doesn’t seem to honor the value that I set in BorderColor. If I set it to red or yellow, the border is always dark gray and there no red/yellow to be found. If it can’t be done, it is what it is.

Screen Shot 2022-08-08 at 12.42.09 PM

Update: actually none of the color options seem to be working. If I change the BackColor from the default green to be yellow or red, it remains green. Is there some kind of trick to get the UI to honor BackColor and BorderColor?

1 Like

The color is controlled via the Shape Status See above

But the border isn’t something you can change. Without doing a lot more hacky stuff.

2 Likes