Home > vbmeg > functions > common > utility > vb_gobject_bring_to_front.m

vb_gobject_bring_to_front

PURPOSE ^

bring graphics object to front of the screen.

SYNOPSIS ^

function vb_gobject_bring_to_front(parent_h, handle)

DESCRIPTION ^

 bring graphics object to front of the screen.
 [USAGE]
    vb_gobject_bring_to_front(<parent_h>, <handle>);
 [IN]
    parent_h : figure or axes handle
      handle : graphics object handle(s)
 [OUT]
    none

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function vb_gobject_bring_to_front(parent_h, handle)
0002 % bring graphics object to front of the screen.
0003 % [USAGE]
0004 %    vb_gobject_bring_to_front(<parent_h>, <handle>);
0005 % [IN]
0006 %    parent_h : figure or axes handle
0007 %      handle : graphics object handle(s)
0008 % [OUT]
0009 %    none
0010 %
0011 % Copyright (C) 2011, ATR All Rights Reserved.
0012 % License : New BSD License(see VBMEG_LICENSE.txt)
0013 
0014 %
0015 % --- Previous check
0016 %
0017 if ~exist('parent_h', 'var'), error('parent_h is a required parameter.'); end
0018 if ~exist('handle', 'var')
0019     error('handle is a required parameter.');
0020 end
0021 
0022 %
0023 % --- Main Procedure
0024 %
0025 h = get(parent_h, 'Children');
0026 del_ix = [];
0027 for k=1:length(handle)
0028     ix = find(h == handle(k));
0029     if ~isempty(ix)
0030         del_ix = [del_ix;ix];
0031     end
0032 end
0033 
0034 h(del_ix) = [];
0035 new_h = [handle; h];
0036 set(parent_h, 'Children', new_h);

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005