Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isReadOnly parameter cannot by dynamic with defined editor #69

Open
nrvllrgrs opened this issue May 2, 2017 · 3 comments
Open

isReadOnly parameter cannot by dynamic with defined editor #69

nrvllrgrs opened this issue May 2, 2017 · 3 comments

Comments

@nrvllrgrs
Copy link

I added a toolbar option that allows the player to toggle read-only functionality. That is to say, while in Read-Only mode, the user cannot edit the property grid, trees, lists, etc. But while not in Read-Only mode, the user can has access to the aforementioned functionality.

That said, if AttributePropertyDescriptor uses a custom editor then it remains in the default Read-Only state. I extended CustomTypeDescriptorNodeAdapter where the properties are not cacheable, but the problem remains. Any suggestions how to resolve this issue?

@abeckus
Copy link
Contributor

abeckus commented May 3, 2017

A simpler approach is to create a DomNodeAdapter and register it at root node.
Then have the DomNodeAdapter to monitor all changes and when the Read-only mode is on reject the changes by throwing InvalidTransactionException().
For reference take a look at public class CurveLimitValidator : DomNodeAdapter in DomTreeEditor sample.
Also take a look at DomValidators.

Alan

@nrvllrgrs
Copy link
Author

That may work but that seems contrary to ATF's behavior. That's the equivalent of the Cut, Copy, Paste, Delete buttons always enabled and then a dialog appears if you try to before an invalid action. If the action is invalid, then those buttons are disabled.

@JimHume
Copy link

JimHume commented Jul 25, 2017

Another option is to implement ICommandClient and IInitializable in your editor or form. This will ensure that CanDoCommand(object commandTag) , DoCommand(object commandTag), and UpdateCommand(object commandTag) will be called when the user interface is rendered.

By adding custom logic in those methods, the return value can be set to true or false for any command based on the current state of your IDocument or application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants