But there are still some bugs in.
The Cancel is not indicated and gives just the default values back.
For an edit field comes not the text entered in the field, but a crazy structure (in the example the field "Name")
The answer gives back default instead of the new changed values. (in the example the field "SSN")
Hi!
This looks like a great tool and I'm sure i'll use it.
For now, though, I need just a simple thing which appears to be unaddressed: I want to create a dialog box - just like inputdlg - with an arbitrary number of buttons.
Do you know how one does that?
Thanks!
@Terry - Thanks for reporting the bug. I've confirmed it. Since I'm in a process of making a major update, this bug won't be fixed until v2.0 (there is v1.3 just submitted & pending for MathWorks approval) but here's how to fix it.
Replace the two if-else-end clauses that you posted above with the following:
if isempty(UserOptions) % no option specified, use default
err = {};
return;
elseif ischar(UserOptions) && any(strcmpi(UserOptions,{'on','off'}))
% check if User Resize Option is given as on/off string
UserOptions.Resize = UserOptions;
elseif ~isstruct(UserOptions) && numel(UserOptions)~=1
err{2} = 'Options must be ''on'', ''off'', or a scalar struct.';
return;
end
Let me know if you encounter any other bugs!
Very nice. And thanks for revising.
I'm trying to write some preprocessors for inputsdlg and have been exercises many of its possibilities in testing the front end code.
I think I've come across a bug. in the call to checkcptions() following line 1535:
The first if-then-else group will fail if Options on input is 'on',
so second one will not be reached.
--------
if isempty(UserOptions) % no option specified, use default
err = {};
return;
elseif numel(UserOptions)~=1
err{2} = 'Options struct must be a scalar.';
if errdbg, disp('errdbg: Keyboarding'),sysbeep(2),dbstack, keyboard; end; return;
end
% check if User Resize Option is given as on/off string
if ischar(UserOptions) && strcmpi(UserOptions,{'on','off'})
UserOptions.Resize = UserOptions;
elseif ~isstruct(UserOptions)
err{2} = 'Options must be ''on'', ''off'', or a struct.';
if errdbg, disp('errdbg: Keyboarding'),sysbeep(2),dbstack, keyboard; end; return;
end
---------
If your interested, I'll send you the front-ends when I've finished them
Thanks again,
Terry Nearey
Jason,
I agree with your take on checkoptions(). I've scrapped the function and rewritten it in more-or-so of what you suggested. Also, this change made the user option field names to be case insensitive.
Hopefully, v1.2.2 just upped would fix all checkoptions() related bugs.
Hi Kesh,
New bug for you. This is related to the last one I posted on 11 Jun. Because you modified the Fields to handle the cellstr correctly, the problem migrated to line 1653. I think this line should be changed to
Options.ButtonNames = Fields{2,6}{1};
Personally, I think that the way that this checkoptions function is coded is a little bit strange. If the user specifies a struct as the input, then the struct is not built until later. I think that the struct should be built at the top regardless (using an else), then only add the fields if the user specifies them. This would reduce the problems that you are having now because you are creating fields if they don't exist, but you already specified all of the default values anyway.
Regards,
Jason
Comment only