SDT-base         Contents     Functions         Previous Next     PDF Index

sdt_dialogs

Purpose Common dialog generation tools

Syntax

 ua         = sdt_dialogs('uatable',type,name,obj)
 wd         = sdt_dialogs('getdir',RO);
 [fname,wd] = sdt_dialogs('getfile',RO);

Description

sdt_dialogs gathers interaction utilities through GUI : selection in a list, table filing, file/folder selection ...

getfile,putfile,getdir

reproduces the behaviour of MATLAB function uigetfile,uiputfile and uigetdir with packaged options. It also handles the update of LastWd (path stored in tab Project) and uses it as default search path.

[fname,wd]=sdt_dialogs('getfile');
wd=sdt_dialogs('getdir');
[fname,wd]=sdt_dialogs('putfile');
f0=which('feplot');
RO=struct('title','Select feplot.m file...','osdic','FFImMatScript',...
 'defname',f0);
[fname,wd]=sdt_dialogs('getfile',RO);

% Use relpath to get output in relative format
wd0=fileparts(f0); wd0=sdth.fileutil('cffile',fullfile(wd0,'..'));
RO.relpath=wd0;
[fname,wd]=sdt_dialogs('getfile',RO); % Relative path fname, root wd
RO.allfiles=2;
[fname,wd]=sdt_dialogs('getfile',RO); % Add All files filter at top
RO.title='Select files ...'; RO.defname={f0 which('iiplot')};
RO.multi=1; % Multiselection allowed from GUI
[fname,wd]=sdt_dialogs('getfile',RO);
% From Script : bypass GUI interaction
RO.FromScript=1;
[fname,wd]=sdt_dialogs('getfile',RO);

picklist

packages options forwarded to MATLAB function listdlg to display a picklist from a cell array of char. Options are :

Next optional inputs provide the figure name and the prompt text above the displayed list.

 st={'item1';'item2';'item3'}; % List of items
 % Selection of one item only with preselection of item 2
 i1=sdt_dialogs('picklist-single-initVal2',st,'Select...','Select single item :');
 % Selection of multiple items with preselection of items 2 and 3
 RO=struct('initVal',2:3);
 i1=sdt_dialogs('picklist',st,RO,'Select...','Select multiple items :'); 

dlg

packages options forwarded to MATLAB function msgbox to display a short text in a window with an exit button.

Default behavior is a modal window named "Message..." with a close button.

The message to display is provided as first argument. Second argument can be provided as a structure of options :

 st='This is a message'; % Message to display
 % Display with info icon, window title "Success !" and a 5s countdown before auto closing
 sdt_dialogs('dlg-info-countdown5',st,struct('title','Success !'));

©1991-2024 by SDTools
Previous Up Next