function [activeCode, activeColor] = get_active_QC( hMainFig )

% Retrieve named application data
% -------------------------------
% tsg = getappdata( findobj('Tag', 'TAG_TSG-QC_GUI'), 'tsg_data')
tsg    = getappdata( hMainFig, 'tsg_data');

% get panel handle
% ----------------
hbgQc = findobj(hMainFig, 'tag', 'TAG_QC_DISPLAY_PANEL');

% get selected radio button tag
% -----------------------------
rbTag = get(hbgQc, 'SelectedObject');

% get the key (NO_CONTROL, GOOD, PROBABLY_GOOD, ...) from selected 
% radio button tag
% -----------------------------------------------------------------
key = strrep(get(rbTag,'TAG'), 'TAG_QC_RADIO_', '');

% return active code and color
activeCode  = tsg.qc.hash.(key).code;
activeColor  = tsg.qc.hash.(key).color;
