double-click on "uilistbox" App designer

조회 수: 11 (최근 30일)
joe
joe 2019년 7월 11일
댓글: Ahmet Gökhan POYRAZ 2021년 3월 19일
Hallop everyone,
How can I execute a double-click on ListBox in App Designer?
Thank you in Advance

답변 (2개)

Kevin Chng
Kevin Chng 2020년 1월 23일
편집: Kevin Chng 2020년 1월 23일
Up to R2019b, app designer dont have this feature,
It is because if you click on the selected item, no event will be triggered. Therefore, we could say only single click is allowed under this limitaion.
You can use button to replace list box. [toggle button group will behave same as list box, so you could not use this], use the 'normal' button for this.
For example :
Step 1 : For example : 3 selection: Create 3 button
1.jpg
Step 2 : Create callback function for each of them (it is a bit tedious, I have 3 button, then I have 3 callback function)
2.jpg
Step 3: Create private function click
3.jpg
Step 4 : here you go:
(Single Click the button, it turns blue)
4.jpg
(Double Click the button, it turns red)
5.jpg
You might have further question about ‘howand where could you put your algorithm:
You could put your algorithm in the click function
6.jpg

Chidvi Modala
Chidvi Modala 2019년 7월 18일
In guide, To make the double-click work you only need to write the code below in List box callback
function listbox_Callback(hObject, eventdata, handles)
if strcmp(get(gcf,'selectiontype'),'open')
% here you write write code, which you wanna be executed afer double-click
end
In App designer, associate the below function with ValueChangedFcn callback of the List Box.
function clickcallback(obj,evt)
persistent chk
if isempty(chk)
chk = 1;
pause(0.5); %Add a delay to distinguish single click from a double click
if chk == 1
fprintf(1,'\nI am doing a single-click.\n\n');
chk = [];
end
else
chk = [];
fprintf(1,'\nI am doing a double-click.\n\n');
end
  댓글 수: 8
Brett Mther
Brett Mther 2020년 9월 26일
This solution doesn't work for my application. If I double click on a ListBoxItem that is already selected, the ValueChangedFcn callback doesn't fire.
Ahmet Gökhan POYRAZ
Ahmet Gökhan POYRAZ 2021년 3월 19일
@Brett Mther it doesn't work for my application too.

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

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by