MATLAB Answers

double-click on "uilistbox" App designer

57 views (last 30 days)
joe on 11 Jul 2019
Commented: Brett Mther on 26 Sep 2020
Hallop everyone,
How can I execute a double-click on ListBox in App Designer?
Thank you in Advance


Sign in to comment.

Answers (2)

Kevin Chng
Kevin Chng on 23 Jan 2020
Edited: Kevin Chng on 23 Jan 2020
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
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 ‘howand where could you put your algorithm:
You could put your algorithm in the click function


Sign in to comment.

Chidvi Modala
Chidvi Modala on 18 Jul 2019
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
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 = [];
chk = [];
fprintf(1,'\nI am doing a double-click.\n\n');


Show 4 older comments
Markus Leuthold
Markus Leuthold on 12 Apr 2020
What I don't understand is why such an ugly workaround is needed now that the App Designer was written from scratch. Why didn't Mathworks add callbacks for mouse button pressing/clicking/double-clicking like e.g Qt is doing? These kind of callbacks are needed to do a halfway serious app. It's a pity Mathworks missed this unique chance to really cleanup the mess from GUIDE.
Chidvi Modala
Chidvi Modala on 13 Apr 2020
I have heard that this issue is known and the concerned parties may be investigating further.
Brett Mther
Brett Mther on 26 Sep 2020
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.

Sign in to comment.




Community Treasure Hunt

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

Start Hunting!