enable_editclick_notification (Scripts) Publisher's description
When a user clicks an edit field in a matlab figure, the currentobject property of the figure is not updated immediately. Only after the user has pressed a key is the currentobject property of the figure updated to the edit field handle.
Therefore, when processing a key press, it is often unclear whether the key press should activate a hotkey or whether it is meant as input to an edit field. For example, when the user presses the right arrow key in a movie player, is the intention to advance a frame or has an edit field with a numerical value been clicked? It is not clear.
However, after calling this function with a figure handle as an input, any future clicks on an edit field will cause the currentobject property of the figure to be updated, even before the user has pressed a key. Any existing callbacks of the figure or edit fields will work as normal.
To accomplish this, the function modifies several callbacks: the buttondownfcn of the edit fields in the figure, and the figure's windowbuttondownfcn. By setting the edit fields' enable property to inactive, we can intercept clicks, which we then respond to in the appropriate way in addition to temporarily enabling the eidt field. The original callbacks will be executed as normal, so long as they were of standard form (e.g. fcn(hObject, eventdata)). When the user clicks the figure background or executes an edit field callback, the edit fields are set back to inactive before the normal callback is executed.
Note that after calling this function, edit fields with the enable property set to inactive will now essentialy be on, while the off functionality will be unchanged. Edit fields' enable property should never be set programmatically to on after his function has been called. An invisible text style uicontrol will be created for the purpose of removing focus from edit fields when need be.
I tested this on windows, not sure about mac and linux. Feedback is welcome!
System Requirements:MATLAB 7.10 (2010a)
Program Release Status: New Release
Program Install Support: Install and Uninstall