function dynamicPanel_Workspace(h)
% DYNAMICPANEL_WORKSPACE initializes dynamic panel

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

h.Handles.PNLtimeWorkspace = uipanel('Parent',h.Handles.PNLtime,...
    'Units','Pixels',...
    'BackgroundColor',h.DefaultPos.TimePanelDefaultColor,...
    'BorderType','none',...
    'Position',[5 ...
                5 ...
                h.DefaultPos.widthpnl-10 ...
                h.DefaultPos.TXTtimeSheetbottomoffset-h.DefaultPos.separation-5], ...
    'Visible','off' ...                
    );
% create sheet combobox controls whose values are based on the rawdata
h.Handles.BTNSelectVariable = uicontrol('Parent',h.Handles.PNLtimeWorkspace, ...
    'style','pushbutton', ...
    'Units','Pixels', ...
    'BackgroundColor',h.DefaultPos.TimePanelDefaultColor,...
    'String','Select Variable',...
    'Position',[h.DefaultPos.TXTtimeIndexleftoffset ...
                h.DefaultPos.TXTtimeIndexbottomoffset ...
                h.DefaultPos.TXTtimeIndexwidth ...
                h.DefaultPos.heightbtn],...
    'Callback',{@localButton h} ...
    );
h.Handles.PNLDisplayWorkspaceInfo = uipanel('Parent',h.Handles.PNLtimeWorkspace,...
    'Units','Pixels',...
    'BackgroundColor',h.DefaultPos.TimePanelDefaultColor,...
    'Position',[h.DefaultPos.TXTtimeIndexleftoffset+h.DefaultPos.TXTtimeIndexwidth+h.DefaultPos.separation ...
                5 ...
                h.DefaultPos.widthpnl-10-h.DefaultPos.separation-(h.DefaultPos.TXTtimeIndexleftoffset+h.DefaultPos.TXTtimeIndexwidth+h.DefaultPos.separation) ...
                60] ...
    );
h.Handles.TXTDisplayWorkspaceInfo = uicontrol('Parent',h.Handles.PNLDisplayWorkspaceInfo,...
    'style','text', ...
    'Units','Pixels',...
    'BackgroundColor',h.DefaultPos.TimePanelDefaultColor,...
    'String','',...
    'HorizontalAlignment','Left',...
    'Position',[5 ...
                5 ...
                h.DefaultPos.widthpnl-10-h.DefaultPos.separation-(h.DefaultPos.TXTtimeIndexleftoffset+h.DefaultPos.TXTtimeIndexwidth+h.DefaultPos.separation)-10 ...
                60-20] ...
    );


function localButton(eventSrc, eventData, h)
%% Callback for the absolute/relative time format combo

tmp=tsguis.timeFromWorkspaceDlg([]);
tmp.Parent=h;
tmp.open;
h.IOData.timeFromWorkspace=tmp.OutputValue;
h.IOData.timeFormatFromWorkspace=tmp.OutputValueFormat;
% display the selection
set(h.Handles.TXTDisplayWorkspaceInfo,'String',tmp.OutputString);

