guix Posted November 1, 2013 Share Posted November 1, 2013 (edited) Hello, When I load a custom file, I parse it and get a string from it. Then I would like this string to appear in a textbox in the Save dialog... but no matter what I try, it doesn't work: I read the string from the file successfully, I can set the Title of the textbox, but not it's Value :S private enum PropertyNames { TextBox_ArrayName, } string arrayName = "array_name"; public override PropertyCollection OnCreateSavePropertyCollection() { List<Property> props = new List<Property> { new StringProperty(PropertyNames.TextBox_ArrayName, "array_name") }; return new PropertyCollection(props); } public override ControlInfo OnCreateSaveConfigUI(PropertyCollection props) { ControlInfo configUI = CreateDefaultSaveConfigUI(props); configUI.SetPropertyControlValue(PropertyNames.TextBox_ArrayName, ControlInfoPropertyNames.DisplayName, "Give a name to the array:"); // I can do that to confirm that arrayName is successfully read from the the file: //configUI.SetPropertyControlValue(PropertyNames.TextBox_ArrayName, ControlInfoPropertyNames.DisplayName, arrayName); //Doesn't work //PropertyControlInfo pci = configUI.FindControlForPropertyName(PropertyNames.TextBox_ArrayName); //pci.Property.Value = arrayName; //Doesn't work //props[PropertyNames.TextBox_ArrayName].Value = arrayName; return configUI; } protected override Document OnLoad(Stream input) { ... arrayName = "name_from_file"; ... } protected override void OnSaveT(Document input, Stream output, PropertyBasedSaveConfigToken token, Surface scratchSurface, ProgressEventHandler progressCallback) { ... arrayName = (string)token.GetProperty(PropertyNames.TextBox_ArrayName).Value; ... } I have tried other things but no luck... What did I do wrong? Edited November 1, 2013 by guix Quote Link to comment Share on other sites More sharing options...
midora Posted November 1, 2013 Share Posted November 1, 2013 (edited) You have to know how PropertyBased is working. If a dialog opens then it will show the values of the last saved token. There is a difference between PropertyBasedEffects and PropertyBasedFiletypes. The token of a FileType survives a restart of Paint.NET but an Effect token does not. I forgot to mention that there is an issue which I would call a bug. Cancel of a PropertyBasedFileType does not reset the token to the values after opening of the dialog. Edited November 1, 2013 by midora 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.