Path: news.mathworks.com!not-for-mail
From: "Yair Altman" <altmanyDEL@gmailDEL.comDEL>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Hide and disable uicontrols in groups
Date: Thu, 18 Apr 2013 22:20:16 +0000 (UTC)
Organization: TACT Computer Systems Ltd
Lines: 17
Message-ID: <kkprj0$3sd$1@newscl01ah.mathworks.com>
References: <kkpph6$riu$1@newscl01ah.mathworks.com>
Reply-To: "Yair Altman" <altmanyDEL@gmailDEL.comDEL>
NNTP-Posting-Host: www-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1366323616 3981 172.30.248.48 (18 Apr 2013 22:20:16 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 18 Apr 2013 22:20:16 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 642467
Xref: news.mathworks.com comp.soft-sys.matlab:793872

"Matt J" wrote in message <kkpph6$riu$1@newscl01ah.mathworks.com>...
> 
> I'm designing GUIs where, sometimes, I want whole groups of uicontrols to be hidden from and inaccessible to the user. The tedious way to do this would be to set the Enable and Visibility properties to 'off' for each button individually. However, I was hoping for some way to designate them as a group and hide them using a single property set.
> 
> My first thought was to put them all on a uipanel and control them all through that. This works fine for controlling Visibility. Setting the panel's visibility property off hides everything. However, there doesn't seem to be a corresponding Enable property in a uipanel that can be used to deactivate all the uicontrols residing within it. I tried the HitTest property. That didn't work.
> 
> Any recommendations for how best to do this?


Create a variable that holds an array of the relevant handles, and then enable/disable/hide/display them all at once:

hButtons = [hButton1, hButton2, hButton3];
set(hButtons, 'Enable','off');

Yair Altman 
http://UndocumentedMatlab.com