Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Aborting a set in a PropertyPreSet listener callback
Date: Thu, 18 Oct 2007 23:42:09 +0000 (UTC)
Organization: TACT Computer Systems Ltd
Lines: 34
Message-ID: <ff8r0h$gdq$1@fred.mathworks.com>
References: <ff86su$p1i$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1192750929 16826 172.30.248.38 (18 Oct 2007 23:42:09 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 18 Oct 2007 23:42:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 642467
Xref: news.mathworks.com comp.soft-sys.matlab:433664


"Darik " <dgambleDEL@uwaterlooDEL.caDEL> wrote in message
<ff86su$p1i$1@fred.mathworks.com>...
> Is there a way to abort a requested SET call in a 
> PropertyPreSet listener callback? 
> 
> schema.prop objects have an access flag called 'AbortSet' 
> that would suggest this is possible, but I haven't found 
> anything digging through Mathworks' code. 
> 
> I know I COULD create a corresponding PropertyPostSet 
> listener to 'undo' whatever was done, but this gets pretty 
> unwieldy with linked properties (i.e. setting the XLim 
> property of an axes changes the XLimMode, XTick, etc.)


I never tried it myself, but you can try one of two ways:

1) set the schema.prop's SetFunction to your own callback,
in which you can abort or return the original value. Note
that SetFunction is unsupported in Matlab 6, but is in 7
(unsure about 6.5). See usage example in my uicomponent
submission:
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=14583

2) within your PropertyPreSet callback, retrieve the
original value and use it to modify the suggestedValue back
to the original value. This will effectively abort the
property's modification.

...or ask Mathworks how to use AbortSet (ha ha...)

Yair Altman
http://ymasoftware.com