App Designer how to set value for edit field (numeric)
34 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Egor Liokumovitch
le 17 Oct 2022
Commenté : Kevin Holly
le 17 Oct 2022
Hello,
I'm having issues with the simplest of things. I have an app that opens a "Parameters" window. In this window I should be able to set system parameters, such as:
Carrier Frequency, Carrier Power etc.
I'm trying to edit the initial value from 0, to some default value defined in my main app. I'm not even at a stage of changing this value, just trying to grab the default instead of 0.
From the code view in the app in the "create components function", if I set an initial value manually it adds a line of app.CarrierPowerEditField.Value = 15;
I try to add this line manually at the startup function, but this affects exactly nothing for the actuall app. I still get an edit box with "0".
Only if I add a "set" button, upon press of which it will set app.CarrierPowerEditField.Value = 15 will the value change.
I can add a button for grabbing the default values, but I run into a different issue:
In the main app I create a variable as public property
DefCarPower = 15;
But if I write
app.CarrierPowerEditField.Value = app.DefCarPower;
it says "Unrecognized method, property, or field 'DefCarPower' for class 'SecondWindow'."
What am I doing wrong?
1 commentaire
Kevin Holly
le 17 Oct 2022
Is this "Parameters" window a dialog box created with inputdlg?
Is the "Parameters" window an app? If so, which startup function are you editing, this app or the main app?
Do you have code that you can share?
Réponse acceptée
Kevin Holly
le 17 Oct 2022
If the SecondWindow is an app that was called from the mainapp. You will need to call the property value from the mainapp. The current command calls from the SecondWindow app and it does not find it.
It should be something like this:
app.CarrierPowerEditField.Value = app.Callingapp.DefCarPower;
7 commentaires
Kevin Holly
le 17 Oct 2022
Note, one says CarrierPowerEditFieldLabel and the other CarrierPowerEditField
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!