midora Posted October 5, 2021 Share Posted October 5, 2021 On 10/3/2021 at 7:58 PM, Rick Brewster said: Okay I think I just fixed it for 4.3.2, the OnInitialized() method was just missing a call to Sync() Seems this fixed this 2012 topic 😉 Quote Link to comment Share on other sites More sharing options...
ReMake Posted October 5, 2021 Author Share Posted October 5, 2021 @midora thanks for the clarification. 2 hours ago, midora said: List<PropertyCollectionRule> propRules = new List<PropertyCollectionRule>() { new ReadOnlyBoundToBooleanRule(PropertyNames.Mode, PropertyNames.Gray, false), new ReadOnlyBoundToNameValuesRule(PropertyNames.CustomColor, false, (PropertyNames.Gray, true), (PropertyNames.Mode, ModeOptions.None), (PropertyNames.Mode, ModeOptions.Primary), (PropertyNames.Mode, ModeOptions.Secondary) ), }; Unfortunately, this does not work, because your proposed version of writing the rule is equivalent to this: List<PropertyCollectionRule> propRules = new List<PropertyCollectionRule>() { new ReadOnlyBoundToBooleanRule(PropertyNames.Mode, PropertyNames.Gray, true), new ReadOnlyBoundToNameValuesRule(PropertyNames.CustomColor, true, (PropertyNames.Gray, false), (PropertyNames.Mode, ModeOptions.CustomColor)), }; The color wheel is still always active. Quote Link to comment Share on other sites More sharing options...
midora Posted October 5, 2021 Share Posted October 5, 2021 (edited) No the two expression are not equivalent. The inverse in ReadOnlyBoundToNameValues does not mean De Morgan. Check it out Edited November 3, 2021 by midora 1 Quote Link to comment Share on other sites More sharing options...
MJW Posted October 5, 2021 Share Posted October 5, 2021 4 hours ago, ReMake said: Unfortunately, this does not work, because your proposed version of writing the rule is equivalent to this Midora is, of course correct. You need to apply De Morgan's Law: negating a logical expression consisting of ORed terms produces an expression where the negated terms are ANDed. So your version will disable the control only if all the listed conditions are false. You want to disable the control if ANY of the conditions are false. Since there's no direct way to do this, you must instead list all the conditions for which you want the control disabled. I'll put in another plug for my three-tuple idea: A nice feature would be to also allow an array of three-tuples consisting of two objects (the control and value) and a boolean. If the boolean were true, the condition would hold if the control matched the value; if the boolean were false, the condition would hold if the control didn't match the value. 2 Quote Link to comment Share on other sites More sharing options...
ReMake Posted October 5, 2021 Author Share Posted October 5, 2021 4 hours ago, ReMake said: Unfortunately, this does not work, because your proposed version of writing the rule is equivalent to this: @midora, I take back my words. Yes, these two expressions are not equivalent. Your code works flawlessly. I looked it over carefully and fixed my code a bit. Now my code works too. Thank you for your efforts and your time spent. Quote Link to comment Share on other sites More sharing options...
ReMake Posted October 5, 2021 Author Share Posted October 5, 2021 @MJW, you beat me to it while I was working with the translator. Quote Link to comment Share on other sites More sharing options...
ReMake Posted October 5, 2021 Author Share Posted October 5, 2021 6 minutes ago, MJW said: You want to disable it if ANY of the conditions are true. Yes, it was my mistake. Quote Link to comment Share on other sites More sharing options...
midora Posted October 5, 2021 Share Posted October 5, 2021 @ReMakeGlad you figured it out. One of the reasons doing OBL years ago was that I had to manage complex conditions which I couldn't handle in PropertyBased plugins. It's much easier to subscribe to value changed events and check conditions but for sure more error prone. So you need a little bit experience. Quote Link to comment Share on other sites More sharing options...
ReMake Posted October 5, 2021 Author Share Posted October 5, 2021 15 minutes ago, midora said: So you need a little bit experience. This topic is also my experience. I have acquired new information and new skills. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.