MATLAB Answers

joe
0

double-click on "uilistbox" App designer

Asked by joe
on 11 Jul 2019
Latest activity Commented on by joe
on 19 Jul 2019
Hallop everyone,
How can I execute a double-click on ListBox in App Designer?
Thank you in Advance

  0 Comments

Sign in to comment.

Products


Release

R2018b

1 Answer

Answer by 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
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

  1 Comment

joe
on 19 Jul 2019
Hi Chidvi Modal,
I've already tried that code for App designer but it doesn't work.
the code works like this: the second click must be on a different item as the first.
so I want to click on the same item double-click.
the function "ValueChangedFcn " will not react , if the same item tweece clicked because of the value (in this case second item) doesn't changed.
but for GUIDE your code works properly.
Thank you in Advance #Chidvi Modala

Sign in to comment.