Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Dynamic GUI problems

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89385] Re: Dynamic GUI problems
  • From: David Bailey <dave at Remove_Thisdbailey.co.uk>
  • Date: Sun, 8 Jun 2008 02:30:35 -0400 (EDT)
  • References: <g2dbji$9ks$1@smc.vnet.net>

zac wrote:
> Dear Group,
> 
> building a GUI is highly non-intuitive for me, although I almost felt
> I understand the behaviour of dynamic interactivity.
> 
> I. Problem - Master swich does not control semi-independent sub-
> switches
> This is the classic "set all/none switch" situation, with allowing the
> sub-switches to be set by the user individually. Switching the
> checkbox works, but hitting the buttons won't update checkboxes.
> 
> master = False;
> def = {False, True};
> 
> {Button["All", master = All], Button["None", master = None]}
> {Dynamic[master], Dynamic[sub1], Dynamic[sub2]}
> {sub1, sub2} =
>   Table[DynamicModule[{i = i},
>     Switch[master, All, True, None, False, _, def[[i]]]], {i, 2}];
> {Checkbox[Dynamic[sub1]], Checkbox[Dynamic[sub2]]}
> 
> 
> II. Problem - Checkbox in label of TabView does not work
> 
> TabView[{
>   Checkbox[Dynamic[x]] -> Dynamic[x],
>   "..." -> ""
>   }]
> 
> 
> Any ideas how to solve them?
> 
> Istvan Zachar
> 
The first problem is that the expressions for sub1 and sub2 do not 
contain the Dynamic wrapper. The easiest way is to code the two separately:

master = False;
def = {False, True};

{Button["All", master = All], Button["None", master = None]}
{Dynamic[master], Dynamic[sub1], Dynamic[sub2]}
sub1 = Dynamic[Switch[master, All, True, None, False, _, def[[1]]]];
sub2 = Dynamic[Switch[master, All, True, None, False, _, def[[2]]]];

{Checkbox[Dynamic[sub1]], Checkbox[Dynamic[sub2]]}

In the second problem, you are trying to put a checkbox into the label 
of a tabview. This would be a very unusual thing to do in a GUI - you 
really need a name or an image there - and probably has never been 
designed to work.

David Bailey
http://www.dbaileyconsultancy.co.uk


  • Prev by Date: Re: Instructions in for
  • Next by Date: Re: Major problem with 6.0.2.1
  • Previous by thread: Dynamic GUI problems
  • Next by thread: Re: Dynamic GUI problems