Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
GUIDE: chains of elements, problem with updating the last one
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Dear all; I'm creating a user interface and I'm having some doubts. My user interface has (at least) two tables and two text boxes and the situation is the following:
The user enters some data into the first table, these data are read as soon as they are entered, a calculation is performed and the result is written to the first text box. After that, the user enters some data into the second table, these data are read as soon as they are entered and a calculation involving these data and the number written in the first text box is performed and the result is written to the second text box and this is the final result of the whole GUI. Everything works ok so far.
Now, let's imagine that the user, once he/she has updated the second table, finds a mistake in the first table. So he/she edits the data in the first table. At this point the result of the first calculation is written to the first text box but the final result is not updated in the second text box since the data in the second table weren't updated. In order to have un updated final result the user would have to hit enter for one of the second table cell.
Is there any way to overcome this issue?
Just to be clearer, the code that I have at the moment is:
--table1_edit
----calculation with the data in table1
----results written to textbox1
--table2_edit
----calculation with the data in table1 and the value of textbox1
----results written to textbox2
and what I would probably need (and I don't know how to achieve) is:
--table1_edit
----calculation with the data in table1
----results written to textbox1
--table2_edit OR table1_edit
----calculation with the data in table1 and the value of textbox1
----results written to textbox2
Thank you all for your help!
Regards
Lorenzo
0 Kommentare
Antworten (2)
Evan
am 3 Jul. 2013
Bearbeitet: Evan
am 3 Jul. 2013
I would create a "core" function which does the calculation, and then call that core function in the CellEditCallback for both of your tables. This way, you don't have to have duplicate code in your different callbacks and the editboxes will stay up-to-date even if the user goes back and makes a change in the first table.
Of course, in this "core" function, you'd have to check to make sure that the second table had data entered into it before trying to update the second editbox, just so that the function isn't trying to do operations that can't yet be done, for example when the user first enters data into the first table.
0 Kommentare
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!