Wait to enable an "OK" button unitl empty text boxes are filled

3 次查看(过去 30 天)
I enable a panel in a GUI that has several editable text boxes, an OK button, and a CANCEL button. I want to disable the OK button if one or all of the text boxes are empty, and enable it when all the text boxes are not empty. The CANCEL button is always enabled. How would I write code to say, "Wait until the OK or CANCEL buttons are pressed before resuming the GUI code, while keeping OK button disabled if one or all of the text boxes are empty?"

回答(1 个)

Paulo Silva
Paulo Silva 2011-7-12
You don't say if you are using GUIDE so here are just a few tips, start the GUI with the editboxes all empty and the button disabled (if you want to have something on them by default enable the button), on every one of those editboxes callbacks check if all the boxes have something in them, if true enable the button.

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by