Clear Filters
Clear Filters

GUI: How to "save a mouseclick" when editing a uitable and then clicking elsewhere in the the figure.

2 views (last 30 days)
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.

Answers (1)

Sean de Wolski
Sean de Wolski on 7 Mar 2012
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.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!