How to wait for an event without stopping the program?
이전 댓글 표시
Hello world,
I am using a GUI which displays a list of names. When the user selects a name among this list, I want to call a function, ONLY if the name is selected more than x seconds. I don't want to use a while loop to wait the x seconds, because I don't want my program to cumulate while loops each time the user selects a name. Does anyone know how to solve this problem? Is it possible to create this kind of event/listeners in Matlab? If it is possible, how to do it? Thanks for your help
댓글 수: 5
Walter Roberson
2015년 10월 21일
"selects" how?
dpb
2015년 10월 21일
Besides the query of "how", to me sounds like a very unfriendly user interface design, prone to extreme frustration on the user end.
William Afonso
2015년 10월 22일
Guillaume
2015년 10월 22일
Any user interface that does not behave the same as is standard for the platform is very likely to result in user frustration. Particularly, if there is no cue to the new behaviour.
The expected behaviour of a user interface is that clicking on something has an immediate effect. Not after you press on it for a number of seconds. You're making it harder to use your interface. You may find that instead of trying to adjust to your special interface, the user is simply not going to use it.
What is the rationale for forcing the user to click on the list item for a minimum amount of time? And how are you planning to emulate that for keyboard input?
Walter Roberson
2015년 10월 22일
I could imagine that if you are using up/down to move between list selections then you would not want the selection chosen as soon as you got there because you might want to move further on (or back). I can imagine someone thinking that a good approach would be to allow this kind of movement and to consider a location selected if the user "stopped moving" the keys for long enough. However, the built-in interface for such things depends not upon timing but upon the user pressing return / enter when the item to be selected is reached.
William, pushbuttons do not have a "release" callback: they only fire when the item is clicked on.
채택된 답변
추가 답변 (1개)
William Afonso
2015년 11월 1일
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!