double-click on "uilistbox" App designer
10 次查看(过去 30 天)
显示 更早的评论
Hallop everyone,
How can I execute a double-click on ListBox in App Designer?
Thank you in Advance
0 个评论
回答(2 个)
Kevin Chng
2020-1-23
编辑:Kevin Chng
2020-1-23
Up to R2019b, app designer don’t 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
Step 2 : Create callback function for each of them (it is a bit tedious, I have 3 button, then I have 3 callback function)
Step 3: Create private function click
Step 4 : here you go:
(Single Click the button, it turns blue)
(Double Click the button, it turns red)
You might have further question about ‘how’and ‘where’ could you put your algorithm:
You could put your algorithm in the click function
0 个评论
Chidvi Modala
2019-7-18
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
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
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!