creating multiwindow apps in app designer 2020a

hi,
I have been trying to create a multi window app just like the example in the documentation but its not working.
I think the problem is that i am not able to get my secondary app start function to be startFnc(app, mainapp, x, y) like the example. what I keep getting is startFnc(app, event)
and the error is too many parameters when I click th button to open secondary window
the code line at the error is app.dialogApp=newwindowname(app,x,y)
any advice?

5 Comments

You need to provide the entire error message and the associated code.
I mentioned the code above
the error is "Eror using new window name Too many input arguments"
byw the new window name is the name of the secondary window
That's not the entire error message. There's a lot of info in a typical error message and that info is usually helpful.
The error message will likely point to a line of code. We also need to see that line of code.
ok so the code follows exactly the help on multiwindows in the link below
the error shows at option button callback at the second line (btw app.x and app.y are defined under private properties just like the example above thats why im suspecting the start function of the new window since i cant get it to match the one in the example (i.e startFnc(app, mainapp, x, y) ) )
%disable plot options button while dialog is open
app.OptionsButton.Enable = 'off';
%open the options dialog and pass input
app.DialogApp = New_window_name(app, app.x, app.y);
the error inside app desinger is "Error using new_window_name Too many input arguments"
in the command window the error is
" Eror using new window name Too many input arguments
Error in Main_window/OptionsButtonPushed
app.dialogApp = new_window_name(app, x, y);
Error using matlab.ui.control.internal.controller.componentController/executeUserCallback
Error while evaluating Button PrivateButtonPushedFcn"

Sign in to comment.

 Accepted Answer

The starup function in app 2 will have its own 1st input "app". You shouldn't pass that into the app.
Try this.
app.DialogApp = New_window_name(app.x, app.y);
If that doesn't solve the prblem, please provide,
  1. The new full error message if one exists (copy-pasted or screen shot)
  2. The Startup function in app 2.

6 Comments

my code is as shown below
if i take app out of the button callback i get the same exact error
he error inside app desinger is:
"Error using new_window_name Too many input arguments"
in the command window the error is:
" Eror using new window name Too many input arguments
Error in Main_window/OptionsButtonPushed
app.dialogApp = new_window_name(app, x, y);
Error using matlab.ui.control.internal.controller.componentController/executeUserCallback
Error while evaluating Button PrivateButtonPushedFcn"
%main window properties
properties (Access = private)
dialogApp
x='a';
y='b';
end
methods (Access = public)
function mm(app,x,y)
app.x=x;
app.y=y;
msgbo(sprintf('%1s \n %2s',x,y));
end
end
%-----------------------------------
%start up function for main window
mm(app, app.x, app.y);
%-----------------------------------
%buttonPushed callback
app.dialogApp= new_window_name(app.x, app.y);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%secondary window properties
properties (Access = private)
CallingApp
end
%secondary window start up function
function StartupFcn(app) %this line is built in
app.CallingApp = mainapp;
There's your error.
function StartupFcn(app) %this line is built in
As the demo in the MathWorks documentation shows, you need to add x and y inputs in the startup function which appears to be correct in the code from your question but is missing from the code you shared above.
startFnc(app, mainapp, x, y)
But now that I see the actual code, you will need to pass the app #1 handle, too,
app.DialogApp = New_window_name(app, app.x, app.y);
This is why I asked for the code from the beginning :)
ma sd
ma sd on 14 Jul 2020
Edited: ma sd on 14 Jul 2020
thank you i tried overriding the example with my code and it worked because the secondary startfunction had all the variables in there.
however, how can I get the start function to contain (app, app.x, app.y) by myself as its builtin in app designer and i don't want to override the example?
Glad I could help.

Sign in to comment.

More Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products

Release

R2020a

Asked:

on 14 Jul 2020

Commented:

on 14 Jul 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!