Mathematica 9 is now available
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: [mg89428] Re: Dynamic GUI problems
  • From: m.r at inbox.ru
  • Date: Mon, 9 Jun 2008 02:29:29 -0400 (EDT)
  • References: <g2dbji$9ks$1@smc.vnet.net>

On Jun 7, 1:58 am, zac <replicator... at gmail.com> 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

You can define the button control functions to reset all the switches;
at least I don't see how it can be done simpler:

{Button["All", sub1 = sub2 = True],
 Button["None", sub1 = sub2 = False]}
Checkbox /@ {Dynamic@ sub1, Dynamic@ sub2}

I think what happens with the checkbox inside the tab is that a mouse
click is intercepted by the tab and there's no way to pass it down to
the checkbox. You can have the checkbox argument update in sync with
the TabView control though:

TabView[{Checkbox[Dynamic[x == 1]] -> 1,
  Checkbox[Dynamic[x == 2]] -> 2}, Dynamic[x]]

Maxim Rytin
m.r at inbox.ru


  • Prev by Date: Re: A question about N[...]
  • Next by Date: Re: A question about N[...]
  • Previous by thread: Re: Dynamic GUI problems
  • Next by thread: Re: Dynamic GUI problems