Disable pointer event in App Designer
4 views (last 30 days)
Show older comments
I created an app with app designer that allows to insert data for energetic assets. When the user changes a value on the front end, this value is saved on a database (structure). This callback may be long ... so during its execution I would like to avoid any further editing on the front end.
I have already tried:
- uiprogressdlg: not bad because it makes all the app disable so the user cannot change anything until the end of the callback.
- change Interruptible properties to false and BusyAction to cancel: in this case the new callback is deleted but the user can still change the value on the front end, then the value he sees is different from the value in the database behind.
Therefore, I am thinking that the best way is to prevent any actions from the mouse and keyboard during the execution of a callback. Is there a way to stop pointer event on app designer?
Actually changing the pointer shape to watch is nice but useless because the user can still select an editfield on the app.
0 Comments
Accepted Answer
Adam Danz
on 9 Feb 2021
Edited: Adam Danz
on 9 Feb 2021
To temporarily disable interaction across the entire app, use uiprogressdlg. It sounds like this is too restrictive for your needs.
uipd = uiprogressdlg(app.eyeTrackingReformatUIFigure,'Title','App busy','Indeterminate','on');
% STUFF THAT MAKES ME WAIT GOES HERE
close(startupUIProg)
To temporarily disable interactions for a subset of app components, create a function that recieves a binary flag that enables/disables a set of components.
To toggle the enable/disable properties, call
toggleFileSelection(app, 'off') % disables
% STUFF THAT MAKES ME WAIT GOES HERE
toggleFileSelection(app, 'on') % enables
The toggleFileSelection function merely lists components and sets their enable value. If you want to control an bunch of objects within the same vicinity, consider placing them within a uipanel and then you can toggle the panel instead of listing all of the objects.
function toggleFileSelection(app, state)
% state is true|false or 'on'|'off' to enable|disable components
app.AddfilesButton.Enable = state;
app.UndoButton.Enable = state;
app.SelectedFilesListBox.Enable = state;
app.filesettingsMenu.Enable = state;
app.GeneralfilesettingsMenu.Enable = state;
app.SetoutputfiletagMenu.Enable = state;
end
9 Comments
Adam Danz
on 11 Feb 2021
Edited: Adam Danz
on 11 Feb 2021
I see. There should be some kind of visual indicator as to why they can't interact with the component but I suppose as they become familiar with the app they will learn what they can can't do.
The editboxes have an editable property that you can toggle without changing the visual appearance of the editbox but I don't think all components have that. Other than that, I'm out of ideas 🧐
More Answers (0)
See Also
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!