-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathfcnCallback_cmd_PlaySelected_from_CommandLine.m
53 lines (48 loc) · 1.38 KB
/
fcnCallback_cmd_PlaySelected_from_CommandLine.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
function fcnCallback_cmd_PlaySelected_from_CommandLine()
%% About:
% This function is used to play the currently selected command in the
% command line interface
% Copyright: Mohammad SAFEEA, 20th-July-2018
% Check connection first
if fcn_isConnected()
else
message='Connect to the robot first !!!';
fcn_errorMessage(message);
return;
end
% show confirmation dialog box
quest='Are you sure you want to perfrom the selected command!!!';
title='Confirmation request!!!';
btn1='Apply';
btn2='Cancel';
defbtn=btn2;
answer = questdlg(quest,title,btn1,btn2,defbtn);
switch answer
case btn1
% Perfrom the selected command
h=findobj(0,'tag','txt_CommandLine');
selectedItems = get(h, 'Value');
nomOfSelectedItems=max(max(size(selectedItems)));
if nomOfSelectedItems==0
message='No item is selected';
fcn_errorMessage(message);
return;
end
if nomOfSelectedItems>1
message='Select only one item';
fcn_errorMessage(message);
return;
end
strArray=get(h,'String');
if sum(sum(size(strArray)))==0
message='No items to play';
fcn_errorMessage(message);
return;
else
str=strArray{selectedItems(1)};
fcn_decodeCommandMoveRobot(str);
end
case btn2
% nothing
end
end