| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
|---|
| 2 | "http://www.w3.org/TR/REC-html40/loose.dtd"> |
|---|
| 3 | <html> |
|---|
| 4 | <head> |
|---|
| 5 | <title>Description of keyboard_callback</title> |
|---|
| 6 | <meta name="keywords" content="keyboard_callback"> |
|---|
| 7 | <meta name="description" content="'keyboard_callback:' function activated when a key is pressed on the keyboard"> |
|---|
| 8 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
|---|
| 9 | <meta name="generator" content="m2html © 2003 Guillaume Flandin"> |
|---|
| 10 | <meta name="robots" content="index, follow"> |
|---|
| 11 | <link type="text/css" rel="stylesheet" href="../m2html.css"> |
|---|
| 12 | </head> |
|---|
| 13 | <body> |
|---|
| 14 | <a name="_top"></a> |
|---|
| 15 | <div><a href="../index.html">Home</a> > <a href="index.html">.</a> > keyboard_callback.m</div> |
|---|
| 16 | |
|---|
| 17 | <!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png"> Master index</a></td> |
|---|
| 18 | <td align="right"><a href="index.html">Index for . <img alt=">" border="0" src="../right.png"></a></td></tr></table>--> |
|---|
| 19 | |
|---|
| 20 | <h1>keyboard_callback |
|---|
| 21 | </h1> |
|---|
| 22 | |
|---|
| 23 | <h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
|---|
| 24 | <div class="box"><strong>'keyboard_callback:' function activated when a key is pressed on the keyboard</strong></div> |
|---|
| 25 | |
|---|
| 26 | <h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
|---|
| 27 | <div class="box"><strong>function keyboard_callback(hObject,eventdata,handleshaxes) </strong></div> |
|---|
| 28 | |
|---|
| 29 | <h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
|---|
| 30 | <div class="fragment"><pre class="comment">'keyboard_callback:' function activated when a key is pressed on the keyboard |
|---|
| 31 | -----------------------------------</pre></div> |
|---|
| 32 | |
|---|
| 33 | <!-- crossreference --> |
|---|
| 34 | <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
|---|
| 35 | This function calls: |
|---|
| 36 | <ul style="list-style-image:url(../matlabicon.gif)"> |
|---|
| 37 | <li><a href="delete_object.html" class="code" title="function delete_object(hObject)">delete_object</a> 'delete_object': delete a projection object, defined by its index in the Uvmat list or by its graphic handle</li><li><a href="uvmat.html" class="code" title="function varargout = uvmat(varargin)">uvmat</a> 'uvmat': function associated with the GUI 'uvmat.fig' for images and data field visualization</li></ul> |
|---|
| 38 | This function is called by: |
|---|
| 39 | <ul style="list-style-image:url(../matlabicon.gif)"> |
|---|
| 40 | <li><a href="mouse_up.html" class="code" title="function mouse_up(ggg,eventdata,handles)">mouse_up</a> 'mouse_up': function activated when the mouse button is released</li></ul> |
|---|
| 41 | <!-- crossreference --> |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
|---|
| 45 | <div class="fragment"><pre>0001 <span class="comment">%'keyboard_callback:' function activated when a key is pressed on the keyboard</span> |
|---|
| 46 | 0002 <span class="comment">%-----------------------------------</span> |
|---|
| 47 | 0003 <a name="_sub0" href="#_subfunctions" class="code">function keyboard_callback(hObject,eventdata,handleshaxes)</a> |
|---|
| 48 | 0004 xx=double(get(hObject,<span class="string">'CurrentCharacter'</span>)); <span class="comment">%get the keyboard character</span> |
|---|
| 49 | 0005 cur_axes=get(gcbf,<span class="string">'CurrentAxes'</span>); |
|---|
| 50 | 0006 <span class="keyword">if</span> ~isempty(cur_axes) |
|---|
| 51 | 0007 xlimit=get(cur_axes,<span class="string">'XLim'</span>); |
|---|
| 52 | 0008 ylimit=get(cur_axes,<span class="string">'Ylim'</span>); |
|---|
| 53 | 0009 dx=(xlimit(2)-xlimit(1))/10; |
|---|
| 54 | 0010 dy=(ylimit(2)-ylimit(1))/10; |
|---|
| 55 | 0011 |
|---|
| 56 | 0012 <span class="keyword">if</span> isequal(xx,29)<span class="comment">%move arrow right</span> |
|---|
| 57 | 0013 xlimit=xlimit+dx; |
|---|
| 58 | 0014 <span class="keyword">elseif</span> isequal(xx,28)<span class="comment">%move arrow left</span> |
|---|
| 59 | 0015 xlimit=xlimit-dx; |
|---|
| 60 | 0016 <span class="keyword">elseif</span> isequal(xx,30)<span class="comment">%move arrow up</span> |
|---|
| 61 | 0017 ylimit=ylimit+dy; |
|---|
| 62 | 0018 <span class="keyword">elseif</span> isequal(xx,31)<span class="comment">%move arrow down</span> |
|---|
| 63 | 0019 ylimit=ylimit-dy; |
|---|
| 64 | 0020 <span class="keyword">end</span> |
|---|
| 65 | 0021 set(cur_axes,<span class="string">'XLim'</span>,xlimit) |
|---|
| 66 | 0022 set(cur_axes,<span class="string">'YLim'</span>,ylimit) |
|---|
| 67 | 0023 <span class="keyword">end</span> |
|---|
| 68 | 0024 <span class="keyword">if</span> isequal(xx,8)<span class="comment">%if the delete key is pressed, delete the current object</span> |
|---|
| 69 | 0025 currentobject=gco; |
|---|
| 70 | 0026 huvmat=findobj(allchild(0),<span class="string">'Name'</span>,<span class="string">'uvmat'</span>); |
|---|
| 71 | 0027 UvData=get(huvmat,<span class="string">'UserData'</span>);<span class="comment">%Data associated to the current uvmat interface</span> |
|---|
| 72 | 0028 hlist_object=findobj(huvmat,<span class="string">'Tag'</span>,<span class="string">'list_object'</span>); |
|---|
| 73 | 0029 ObjIndex=get(hlist_object,<span class="string">'Value'</span>); |
|---|
| 74 | 0030 <span class="keyword">if</span> ObjIndex>1 |
|---|
| 75 | 0031 <a href="delete_object.html" class="code" title="function delete_object(hObject)">delete_object</a>(ObjIndex) |
|---|
| 76 | 0032 <span class="keyword">end</span> |
|---|
| 77 | 0033 <span class="keyword">if</span> ishandle(currentobject) |
|---|
| 78 | 0034 tag=get(currentobject,<span class="string">'Tag'</span>);<span class="comment">%tag of the current selected object</span> |
|---|
| 79 | 0035 <span class="keyword">if</span> isequal(tag,<span class="string">'proj_object'</span>) |
|---|
| 80 | 0036 <a href="delete_object.html" class="code" title="function delete_object(hObject)">delete_object</a>(currentobject) |
|---|
| 81 | 0037 <span class="keyword">end</span> |
|---|
| 82 | 0038 <span class="keyword">end</span> |
|---|
| 83 | 0039 <span class="keyword">elseif</span> isequal(xx,112)<span class="comment">% key 'p'</span> |
|---|
| 84 | 0040 <a href="uvmat.html" class="code" title="function varargout = uvmat(varargin)">uvmat</a>(<span class="string">'runplus_Callback'</span>,hObject,eventdata,handleshaxes) |
|---|
| 85 | 0041 <span class="comment">% runplus_Callback(hObject,eventdata,handleshaxes)</span> |
|---|
| 86 | 0042 <span class="keyword">elseif</span> isequal(xx,109)<span class="comment">% key 'm'</span> |
|---|
| 87 | 0043 <a href="uvmat.html" class="code" title="function varargout = uvmat(varargin)">uvmat</a>(<span class="string">'runmin_Callback'</span>,hObject,eventdata,handleshaxes) |
|---|
| 88 | 0044 <span class="keyword">end</span> |
|---|
| 89 | 0045 |
|---|
| 90 | 0046 AxeData=get(cur_axes,<span class="string">'UserData'</span>); |
|---|
| 91 | 0047 <span class="keyword">if</span> isfield(AxeData,<span class="string">'ParentRect'</span>)<span class="comment">% update the position of the parent rectangle represneting the field</span> |
|---|
| 92 | 0048 hparentrect=AxeData.ParentRect; |
|---|
| 93 | 0049 rect([1 2])=[xlimit(1) ylimit(1)]; |
|---|
| 94 | 0050 rect([3 4])=[xlimit(2)-xlimit(1) ylimit(2)-ylimit(1)]; |
|---|
| 95 | 0051 set(hparentrect,<span class="string">'Position'</span>,rect) |
|---|
| 96 | 0052 <span class="keyword">end</span></pre></div> |
|---|
| 97 | <hr><address>Generated on Fri 13-Nov-2009 11:17:03 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> © 2003</address> |
|---|
| 98 | </body> |
|---|
| 99 | </html> |
|---|