Re: Dynamic GUI problems
- To: mathgroup at smc.vnet.net
- Subject: [mg89442] Re: Dynamic GUI problems
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Mon, 9 Jun 2008 06:20:39 -0400 (EDT)
- References: <g2dbji$9ks$1@smc.vnet.net> <g2fuco$2ha$1@smc.vnet.net> <g2ij36$ror$1@smc.vnet.net>
Szabolcs Horv=E1t wrote: > David Bailey wrote: >> 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 th= e >>> 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 separa= tely: >> >> 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. >> > > Google Groups ate my reply to this question, and I have not saved it ..=