From: Shahar on
Hi,

Is there any way to catch incoming modal dialog box (and close it)?
I can't disable the dialog box because its part of pcode which cannot be changed and need to be used.

I currently use timer in the code, but the execution of timer within another timer cause problems (and won't execute), so I'm looking for a different method to do

Thanks in advance,
Shahar

% kill the modal dialog as soon as it pops out
myTimer = timer('ExecutionMode', 'fixedRate', ...
'Name', 'MyTimer', ...
'BusyMode', 'queue', ...
'TimerFcn', @FindAndKill,...
'StartDelay', 0.2, ...
'Period', 0.2);
start( myTimer);

% the modal dialog will pop up after this
BringOnTheModalDialog;

stop(myTimer);
delete(myTimer);

function FindAndKill( varargin )

allHandle = allchild(0);
allName = get(allHandle, 'Name');
TheNameMatch = strcmpi(allName, 'ThisIsTheOne');
myBox = allHandle( TheNameMatch );

if ~isempty(myBox)

set(get(myBox,'CurrentObject'), 'String', 'Yes');
set(myBox, 'waitstatus', 'inactive');
drawnow;

end
 | 
Pages: 1
Prev: GUI colors Linux
Next: Nelder-Mead algorithm