Borrar filtros
Borrar filtros

Disable pointer event in App Designer

1 visualización (últimos 30 días)
Riccardo Barilli
Riccardo Barilli el 9 de Feb. de 2021
Editada: Adam Danz el 11 de Feb. de 2021
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.

Respuesta aceptada

Adam Danz
Adam Danz el 9 de Feb. de 2021
Editada: Adam Danz el 9 de Feb. de 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 comentarios
Riccardo Barilli
Riccardo Barilli el 11 de Feb. de 2021
No Adam you got the goal totally, I would have liked to make the user wait without fading the component!
Adam Danz
Adam Danz el 11 de Feb. de 2021
Editada: Adam Danz el 11 de Feb. de 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 🧐

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by