GUI: How to "save a mouseclick" when editing a uitable and then clicking elsewhere in the the figure.
2 次查看(过去 30 天)
显示 更早的评论
Dear MATLAB community,
I will try to describe what I want to do as best I can:
1. Suppose you have a GUI with a uitable and a button in it, and you are entering a value.
2. You are done typing, and are now in the state where the keyboard's "writing sign" (i.e. flickering vertical line) is still inside the cell you were editing, at the end of your input.
3. [Without pressing Enter, tab or etc.,] you now try to click on a button in the GUI so that it performs an action.
What happens is that the first mouse click on the button is "wasted" on deselecting the edited cell, and only the 2nd click actually "touches" the button.
The task seems simple - I want the 1st click to hit the button. Is this possible to do?
I've tried playing around with different uitable properties and editing the ButtonDownFcn to have the same effect as the click, but to no avail.
I am pretty sure that this is something which isn't limited by the OS (I'm currently using WinXP), as I tried doing a similar action in other applications, where it worked without the additional click.
If anybody has any idea how to fix this, or knows a workaround which has the same effect - do share! :)
.
Thanks in advance,
Iliya.
0 个评论
回答(1 个)
Sean de Wolski
2012-3-7
This is expected when working with a uitable with editable cells.
After selecting a cell, clicking somewhere outside of this cell will only end "edit mode" and fire the CellEditCallback if applicable, you will not be able to push a pushbutton with this same single click.
You could probably rig up a CellEditCallback that gets the currentpoint of the mouse. If the current point of the mouse is over the button, it fires the engine of the pushbutton's callback.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!