Disable pointer event in App Designer

조회 수: 2 (최근 30일)
Riccardo Barilli
Riccardo Barilli 2021년 2월 9일
편집: Adam Danz 2021년 2월 11일
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.

채택된 답변

Adam Danz
Adam Danz 2021년 2월 9일
편집: Adam Danz 2021년 2월 9일
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
Riccardo Barilli
Riccardo Barilli 2021년 2월 11일
No Adam you got the goal totally, I would have liked to make the user wait without fading the component!
Adam Danz
Adam Danz 2021년 2월 11일
편집: Adam Danz 2021년 2월 11일
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 🧐

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Identification에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by