function initializeButtons(h)
% INITIALIZEBUTTONS initializes the buttons at the bottom of the dialog

% Author: Rong Chen 
% Revised: 
% Copyright 1986-2004 The MathWorks, Inc.

% -------------------------------------------------------------------------
%% Build buttons at the bottom of the figure window
% -------------------------------------------------------------------------
h.Handles.BTNok = uicontrol('Parent',h.Figure, ...
    'style','pushbutton', ...
    'Units','Pixels', ...
    'BackgroundColor',h.DefaultPos.FigureDefaultColor,...
    'String','Import',...
    'Position',[h.DefaultPos.leftoffsetOKbtn ...
                h.DefaultPos.bottomoffsetbtn ...
                h.DefaultPos.widthbtn ...
                h.DefaultPos.heightbtn],...
    'Callback',{@localOK h} ...
    );
h.Handles.BTNcancel = uicontrol('Parent',h.Figure, ...
    'style','pushbutton', ...
    'Units','Pixels', ...
    'BackgroundColor',h.DefaultPos.FigureDefaultColor, ...
    'String','Cancel', ...
    'Position',[h.DefaultPos.leftoffsetCANCELbtn ...
                h.DefaultPos.bottomoffsetbtn ...
                h.DefaultPos.widthbtn ...
                h.DefaultPos.heightbtn], ...
    'Callback',{@localCANCEL h} ...
    );
h.Handles.BTNhelp = uicontrol('Parent',h.Figure, ...
    'style','pushbutton', ...
    'Units','Pixels', ...
    'BackgroundColor',h.DefaultPos.FigureDefaultColor, ...
    'String','Help',...
    'Position',[h.DefaultPos.leftoffsetHELPbtn ...
                h.DefaultPos.bottomoffsetbtn ...
                h.DefaultPos.widthbtn ...
                h.DefaultPos.heightbtn], ...
    'Callback',{@localHELP h}...
    );


function localOK(eventSrc, eventData, h)
% callback for the OK button

% call savets function and if it returns true, make the dialog invisible
if (h.savets)
    % if activex web component link is connected, disconnect it
    set(h.Figure,'visible','off');
end


function localCANCEL(eventSrc, eventData, h)
% callback for the CANCEL button

% if activex web component link is connected, disconnect it
set(h.Figure,'visible','off');


function localHELP(eventSrc, eventData, h)
% callback for the HELP button

function localHELP(eventSrc, eventData, h)
% callback for the HELP button

helpdlg(sprintf('%s\n\n%s\n\n%s\n\n%s\n\n%s',...
    'General Workflow for Importing Time Series Object(s):',...
    'Step 1: highlight the data variable from the table and define the block range in the edit boxes', ...
    'Step 2: define the time vector source', ...
    'Step 3: click the Import button'),...
    'Help');



