1. Win32lib bug - Checkboxes become visible inside TabItems.
- Posted by marky1124 Nov 05, 2009
- 1929 views
Hi,
I've found a bug with the handling of the visibility of checkboxes. If a checkbox is created inside a TabItem control and set to invisible. Then if the user switches to another TabItem and returns to the first then the checkbox becomes visible. Also if the invisible checkbox is on a TabItem other than the initial one then it'll be visible as soon as the user visits the tab.
I think the problem is that the visibility status of a checkbox is being turned on when the user changes tab.
In my test case I found that checkboxes inside a group do not exhibit the same problem on v0.70.4 or v0.70.19 of the Win32Lib library. In v0.60.6 of the library I found that all of the checkboxes inside a TabItem are always visible, so I think some improvements to this area of the code have already been made.
I've created a test case below which I hope will suitably demonstrate the problem.
-- code generated by Win32Lib IDE v1.0.4 Build July-06-2008 constant TheProgramType="exw" -- include Win32Lib.ew include "C:/EUPHORIA/win32lib_v0.70.19/Include/Win32Lib.ew" without warning -------------------------------------------------------------------------------- -- Window Window1 constant Window1 = createEx( Window, "Demo of naughty checkboxes", 0, Default, Default, 394, 494, 0, 0 ) constant TabControl7 = createEx( TabControl, "TabControl7", Window1, 72, 176, 220, 192, 0, 0 ) constant TabItem8 = createEx( TabItem, "Tab1", TabControl7, 0, 0, 0, 0, 0, 0 ) constant Group2 = createEx( Group, "There's a checkbox in here", TabItem8, 16, 36, 190, 60, 0, 0 ) constant CheckBox3 = createEx( CheckBox, "CheckBox3", Group2, 24, 24, 148, 20, 0, 0 ) setVisible( CheckBox3, w32False ) constant CheckBox4 = createEx( CheckBox, "CheckBox4", TabItem8, 40, 156, 148, 20, 0, 0 ) setVisible( CheckBox4, w32False ) constant TabItem39 = createEx( TabItem, "Tab2", TabControl7, 0, 0, 0, 0, 0, 0 ) constant Group40 = createEx( Group, "There's a checkbox in here", TabItem39, 16, 36, 190, 60, 0, 0 ) constant CheckBox1 = createEx( CheckBox, "CheckBox1", TabItem39, 40, 128, 148, 20, 0, 0 ) setVisible( CheckBox1, w32False ) constant CheckBox2 = createEx( CheckBox, "CheckBox2", Group40, 24, 24, 148, 20, 0, 0 ) setVisible( CheckBox2, w32False ) constant LText45 = createEx( LText, "Handling of whether a checkbox is visible or not is affected by it being inside a TabItem. All the checkboxes in this example are set to setVisible(cb,w32False). Initially on Tab2 you won't see any checkboxes. Switch to Tab1 and you'll see one, then switch back to Tab2 and one will appear. The act of switching tab seems to override the original setVisible setting. You'll also notice that the checkboxes inside the group control remain invisible.", Window1, 24, 20, 308, 140, 0, 0 ) constant CheckBox7 = createEx( CheckBox, "CheckBox7", Window1, 76, 416, 148, 20, 0, 0 ) setVisible( CheckBox7, w32False ) constant LText47 = createEx( LText, "There's a checkbox below here", Window1, 72, 388, 240, 20, 0, 0 ) constant LText57 = createEx( LText, "There's a checkbox below here", TabItem8, 20, 104, 180, 20, 0, 0 ) constant LText58 = createEx( LText, "There's a checkbox below here", TabItem39, 20, 104, 180, 20, 0, 0 ) --------------------------------------------------------- --------------------------------------------------------- WinMain( Window1,Normal )
Is there any chance someone can fix this for me please?
All the best,
Cheers,
Mark
2. Re: Win32lib bug - Checkboxes become visible inside TabItems.
- Posted by wd40 Nov 08, 2009
- 1850 views
hello Mark,
It appears you are using Judith's IDE to create your program.
Re-create it using a seperate layer for each tab.
Using Edit/New Controls Layer.
All Check Boxs, uncheck Visible in the PropertyList.
Also Click on each layer and click Edit/All Controls in active layer may use setLayer.
Project/save.
Now when you Launch/Pass controls and routines to editor of your choice. IDE should create in you editor an IDE_labletable for each layer and 2 fucnctions
setLayerVisible(integer windowName,object layerName,integer state) and setLayerEnable(integer windowName,object layerName,integer state)
State being on or off.
Using these functions you can control which layers (tabs & checkboxes) are visible.
Don Cole
3. Re: Win32lib bug - Checkboxes become visible inside TabItems.
- Posted by marky1124 Nov 09, 2009
- 1727 views
Hi Dan,
Thanks very much for the information. That sounds like a viable workaround. I have tried to follow your steps with my demo and put a setLayerVisible(Window1, "Layer 1", 0) in the general code. That didn't work. Do I need to do it the moment a tab is clicked to counteract the tab click making things visible?
Would you be kind enough to post an example please, perhaps based on mine.
Cheers,
Mark
4. Re: Win32lib bug - Checkboxes become visible inside TabItems.
- Posted by DanM Nov 10, 2009
- 1774 views
Mark,
I think you're right about the bug, though your example worked slightly differently on my system, different Win32Lib version.
Here's a work-around:
set all desired checkboxes invisible in the "Window1_onActivate" event, and then also set each tabs desired continued invisible checkboxes invisible in that tabs "onClick" event. And of course, provide for making the checkboxes visible when desired.
Example follows. Hope it works with your version Win32Lib
DanM
-- code generated by Win32Lib IDE v0.20.1 include Win32Lib.ew without warning -- intent is to test/solve problem with check box on tab -- not being invisible when set invisible initially, but tabs subsequently selected. -- solution is to make them invisible on program entry and whenever tab is -- selected. -------------------------------------------------------------------------------- -- Window Window1 constant Window1 = createEx( Window, "Window1", 0, 76, 92, 400, 300, 0, 0 ) constant TabControl9 = createEx( TabControl, "TabControl9", Window1, 60, 44, 288, 144, 0, 0 ) constant TabItem1 = createEx( TabItem, "TabItem1", TabControl9, 0, 0, 0, 0, 0, 0 ) constant CheckBox1 = createEx( CheckBox, "CheckBox1", TabItem1, 20, 68, 148, 20, 0, 0 ) constant LText13 = createEx( LText, "INVISIBLE CHECK BOX BELOW", TabItem1, 16, 48, 184, 20, 0, 0 ) constant CheckBox16 = createEx( CheckBox, "CheckBox16", Window1, 848, 128, 148, 20, 0, 0 ) constant TabItem2 = createEx( TabItem, "TabItem2", TabControl9, 0, 0, 0, 0, 0, 0 ) constant CheckBox2 = createEx( CheckBox, "CheckBox2", TabItem2, 20, 68, 148, 20, 0, 0 ) constant LText19 = createEx( LText, "invisible check box below", TabItem2, 16, 48, 148, 20, 0, 0 ) constant PushButton20 = createEx( ToggleButton, "CLICK to make CheckBox vis or invis", TabItem1, 16, 92, 204, 28, 0, 0 ) --------------------------------------------------------- -------------------------------------------------------------------------------- procedure Window1_onActivate (integer self, integer event, sequence params)--params is () setVisible(CheckBox1, 0) setVisible(CheckBox2, 0) end procedure setHandler( Window1, w32HActivate, routine_id("Window1_onActivate")) -------------------------------------------------------------------------------- procedure TabItem1_onClick (integer self, integer event, sequence params)--params is () setVisible(CheckBox1, 0) end procedure setHandler( TabItem1, w32HClick, routine_id("TabItem1_onClick")) -------------------------------------------------------------------------------- procedure TabItem2_onClick (integer self, integer event, sequence params)--params is () setVisible(CheckBox2, 0) end procedure setHandler( TabItem2, w32HClick, routine_id("TabItem2_onClick")) -------------------------------------------------------------------------------- procedure PushButton20_onClick (integer self, integer event, sequence params)--params is () if isVisible(CheckBox1) then setVisible(CheckBox1, 0) else setVisible(CheckBox1, 1) end if end procedure setHandler( PushButton20, w32HClick, routine_id("PushButton20_onClick")) WinMain( Window1,Normal )
5. Re: Win32lib bug - Checkboxes become visible inside TabItems.
- Posted by wd40 Nov 10, 2009
- 1684 views
` I am using winLib.ew ver. 0.70.4a 17/June/2008 and found no problem with your code using it. There may be a problem with your version of winlib.
Any I made a sample code for you.
Notice that TabItemA is both TabItem8 and TabItem4 and TabItemB is both TabItem3 and TabItem7.
constant TheProgramType="exw" include Win32lib.ew without warning -------------------------------------------------------------------------------- -- Window Window1 global constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300, 0, 0 ) global constant TabControl2 = createEx( TabControl, "TabControl2", Window1, 136, 100, 148, 60, 0, 0 ) global constant TabItem3 = createEx( TabItem, "TabItemB", TabControl2, 0, 0, 0, 0, 0, 0 ) global constant TabItem4 = createEx( TabItem, "TabItemA", TabControl2, 0, 0, 0, 0, 0, 0 ) global constant TabControl7 = createEx( TabControl, "TabControl7", Window1, 136, 100, 148, 60, 0, 0 ) global constant TabItem11 = createEx( TabItem, "TabItemB", TabControl7, 0, 0, 0, 0, 0, 0 ) global constant TabItem8 = createEx( TabItem, "TabItemA", TabControl7, 0, 0, 0, 0, 0, 0 ) global constant CheckBox5 = createEx( CheckBox, "CheckBox5", TabItem3, 24, 36, 88, 20, 0, 0 ) global constant CheckBox6 = createEx( CheckBox, "CheckBox6", TabItem4, 48, 36, 80, 20, 0, 0 ) global constant CheckBox12 = createEx( CheckBox, "CheckBox12", TabItem8, 24, 24, 88, 20, 0, 0 ) global constant CheckBox13 = createEx( CheckBox, "CheckBox13", TabItem11, 12, 32, 92, 20, 0, 0 ) --------------------------------------------------------- setVisible({TabControl7},0) sequence IDE_labeltable IDE_labeltable = { {Window1,"Layer 0",CheckBox5}, {Window1,"Layer 0",CheckBox6}, {Window1,"Layer 0",TabControl2}, {Window1,"Layer 0",TabItem3}, {Window1,"Layer 0",TabItem4}, {Window1,"Layer 1",CheckBox12}, {Window1,"Layer 1",CheckBox13}, {Window1,"Layer 1",TabControl7}, {Window1,"Layer 1",TabItem11}, {Window1,"Layer 1",TabItem8} } function setLayerVisible(integer windowName,object layerName,integer state) integer foundIt foundIt=0 for i=1 to length(IDE_labeltable) do if sequence(layerName) then if equal(windowName,IDE_labeltable[i][1]) and equal(layerName,IDE_labeltable[i][2]) then setVisible(IDE_labeltable[i][3],state) foundIt=w32True elsif foundIt then exit end if else if equal(windowName,IDE_labeltable[i][1]) and layerName=i-1 then for j=1 to length(IDE_labeltable) do setVisible(IDE_labeltable[j][3],state) end for foundIt=w32True elsif foundIt then exit end if end if end for if foundIt then return 0 else return 1 end if end function function setLayerEnable(integer windowName,object layerName,integer state) integer foundIt foundIt=0 for i=1 to length(IDE_labeltable) do if sequence(layerName) then if equal(windowName,IDE_labeltable[i][1]) and equal(layerName,IDE_labeltable[i][2]) then setEnable(IDE_labeltable[i][3],state) foundIt=w32True elsif foundIt then exit end if else if equal(windowName,IDE_labeltable[i][1]) and layerName=i-1 then for j=1 to length(IDE_labeltable) do setEnable(IDE_labeltable[j][3],state) end for foundIt=w32True elsif foundIt then exit end if end if end for if foundIt then return 0 else return 1 end if end function -------------------------------------------------------------------------------- procedure TabItem3_onClick (integer self, integer event, sequence params)--params is () VOID=setLayerVisible(Window1,"Layer 0",0) VOID=setLayerVisible(Window1,"Layer 1",1) setFocus(TabItem11) end procedure setHandler( TabItem3, w32HClick, routine_id("TabItem3_onClick")) -------------------------------------------------------------------------------- procedure TabItem8_onClick (integer self, integer event, sequence params)--params is () VOID=setLayerVisible(Window1,"Layer 1",0) VOID=setLayerVisible(Window1,"Layer 0",1) setFocus(TabItem4) end procedure setHandler( TabItem8, w32HClick, routine_id("TabItem8_onClick")) -------------------------------------------------------------------------------- WinMain( Window1,Normal )
Don Cole
6. Re: Win32lib bug - Checkboxes become visible inside TabItems.
- Posted by marky1124 Nov 11, 2009
- 1651 views
Thank you both, Dan & Don, for your examples. They both work for me. The key workaround technique being to use the onClick event on the TabItem to hide the checkboxes that the win32lib will have incorrectly made visible. I incorporated the setVisible() calls into my example and it works now, although the example reveals another redraw problem. When toggling the checkboxes from visible to invisible the checkbox inside the group does not disappear until you switch tab. I've had redraw issues with controls inside groups before. I think this is another problem within Win32lib.
-- code generated by Win32Lib IDE v1.0.4 Build July-06-2008 constant TheProgramType="exw" -- include "C:/EUPHORIA/win32lib_v0.60.6/Include/Win32Lib.ew" -- include "C:/EUPHORIA/win32lib_v0.70.4/Include/Win32Lib.ew" -- include "C:/EUPHORIA/win32lib_v0.70.4a.copy/Include/Win32Lib.ew" -- include "C:/EUPHORIA/win32lib_v0.70.19/Include/Win32Lib.ew" include Win32Lib.ew without warning -------------------------------------------------------------------------------- -- Window Window1 constant Window1 = createEx( Window, "Demo 2 of naughty checkboxes", 0, Default, Default, 394, 494, 0, 0 ) constant TabControl7 = createEx( TabControl, "TabControl7", Window1, 72, 176, 220, 192, 0, 0 ) constant TabItem1 = createEx( TabItem, "Tab1", TabControl7, 0, 0, 0, 0, 0, 0 ) constant TabItem2 = createEx( TabItem, "Tab2", TabControl7, 0, 0, 0, 0, 0, 0 ) constant LText45 = createEx( LText, "Handling of whether a checkbox is visible or not is affected by it being inside a TabItem. Switching tabs by default makes invisible checkboxes visible. This example uses an onClick event on the TabItem to force the checkboxes to have the desired visibility status. Notice another issue. When switching from visible to invisible the the checkbox inside the group doesn't disappear. This appears to be a redraw/refresh issue.", Window1, 24, 20, 308, 100, 0, 0 ) constant PushButton60 = createEx( PushButton, "Checkboxes are invisible, click to toggle", Window1, 68, 132, 224, 28, 0, 0 ) constant Tab1Group = createEx( Group, "There's a checkbox in here", TabItem1, 16, 36, 190, 60, 0, 0 ) constant Tab2Group = createEx( Group, "There's a checkbox in here", TabItem2, 16, 36, 190, 60, 0, 0 ) constant Tab1GroupCheckBox = createEx( CheckBox, "Tab1GroupCheckBox", Tab1Group, 24, 24, 148, 20, 0, 0 ) setVisible( Tab1GroupCheckBox, w32False ) constant Tab2GroupCheckBox = createEx( CheckBox, "Tab2GroupCheckBox", Tab2Group, 24, 24, 148, 20, 0, 0 ) setVisible( Tab2GroupCheckBox, w32False ) constant LText57 = createEx( LText, "There's a checkbox below here", TabItem1, 20, 104, 180, 20, 0, 0 ) constant LText58 = createEx( LText, "There's a checkbox below here", TabItem2, 20, 104, 180, 20, 0, 0 ) constant Tab2CheckBox = createEx( CheckBox, "Tab2CheckBox", TabItem2, 40, 128, 148, 20, 0, 0 ) setVisible( Tab2CheckBox, w32False ) constant Tab1CheckBox = createEx( CheckBox, "Tab1CheckBox", TabItem1, 40, 156, 148, 20, 0, 0 ) setVisible( Tab1CheckBox, w32False ) constant LText47 = createEx( LText, "There's a checkbox below here", Window1, 72, 388, 240, 20, 0, 0 ) constant CheckBox5 = createEx( CheckBox, "CheckBox5", Window1, 76, 416, 148, 20, 0, 0 ) setVisible( CheckBox5, w32False ) -------------------------------------------------------------------------------- atom cbVisible cbVisible = w32False sequence Tab1CheckBoxes Tab1CheckBoxes = {Tab1CheckBox, Tab1GroupCheckBox, CheckBox5} sequence Tab2CheckBoxes Tab2CheckBoxes = {Tab2CheckBox, Tab2GroupCheckBox, CheckBox5} -------------------------------------------------------------------------------- procedure TabItem1_onClick (integer self, integer event, sequence params)--params is () setVisible(Tab1CheckBoxes, cbVisible) end procedure setHandler( TabItem1, w32HClick, routine_id("TabItem1_onClick")) -------------------------------------------------------------------------------- procedure TabItem2_onClick (integer self, integer event, sequence params)--params is () setVisible(Tab2CheckBoxes, cbVisible) end procedure setHandler( TabItem2, w32HClick, routine_id("TabItem2_onClick")) -------------------------------------------------------------------------------- procedure PushButton60_onClick (integer self, integer event, sequence params)--params is () if cbVisible then cbVisible = w32False setText(self, "Checkboxes are invisible, click to toggle") else cbVisible = w32True setText(self, "Checkboxes are visible, click to toggle") end if VOID = invokeHandler(TabItem1, w32HClick, {}) VOID = invokeHandler(TabItem2, w32HClick, {}) -- repaintWindow(Window1) -- doEvents(0) end procedure setHandler( PushButton60, w32HClick, routine_id("PushButton60_onClick")) --------------------------------------------------------- WinMain( Window1,Normal )
Doing a repaintWindow(Window1) at the end of the PushButton Onclick routine causes other elements to disappear, the group border lines and the "There's a checkbox below here" label.
Cheers,
Mark
7. Re: Win32lib bug - Checkboxes become visible inside TabItems.
- Posted by DanM Nov 11, 2009
- 1647 views
Thank you both, Dan & Don, for your examples. They both work for me. The key workaround technique being to use the onClick event on the TabItem to hide the checkboxes that the win32lib will have incorrectly made visible. I incorporated the setVisible() calls into my example and it works now, although the example reveals another redraw problem. When toggling the checkboxes from visible to invisible the checkbox inside the group does not disappear until you switch tab. I've had redraw issues with controls inside groups before. I think this is another problem within Win32lib.
<snip>
Doing a repaintWindow(Window1) at the end of the PushButton Onclick routine causes other elements to disappear, the group border lines and the "There's a checkbox below here" label.
Cheers,
Mark
You're right again; a simple and effective work around is to include a "setVisible,0" and then a "setVisible,1" for the GROUP containing the checkbox at the same time as setting the checkbox invisible.
That work-around is in the pushbutton click event.
code follows:
-- code generated by Win32Lib IDE v0.20.1 include Win32Lib.ew without warning -- intent is to test/solve problem with check box on tab -- not being invisible when set but tabs selected. -- solution is to make them invisible on entry and whenever -- selected. -- now also works around check box in GROUP not being made invisible -- until click other tab, by making group vis and then invis at same time -- as making checkbox invis. -------------------------------------------------------------------------------- -- Window Window1 constant Window1 = createEx( Window, "Window1", 0, 76, 92, 557, 300, 0, 0 ) constant TabControl9 = createEx( TabControl, "TabControl9", Window1, 64, 44, 472, 144, 0, 0 ) constant TabItem1 = createEx( TabItem, "TabItem1", TabControl9, 0, 0, 0, 0, 0, 0 ) constant Group21 = createEx( Group, "Group21", TabItem1, 280, 48, 158, 60, 0, 0 ) constant CheckBox3 = createEx( CheckBox, "CheckBox3", Group21, 20, 20, 118, 20, 0, 0 ) constant CheckBox1 = createEx( CheckBox, "CheckBox1", TabItem1, 20, 68, 148, 20, 0, 0 ) constant LText13 = createEx( LText, "INVISIBLE CHECK BOX BELOW", TabItem1, 16, 48, 184, 20, 0, 0 ) constant CheckBox16 = createEx( CheckBox, "CheckBox16", Window1, 848, 128, 148, 20, 0, 0 ) constant TabItem2 = createEx( TabItem, "TabItem2", TabControl9, 0, 0, 0, 0, 0, 0 ) constant CheckBox2 = createEx( CheckBox, "CheckBox2", TabItem2, 20, 68, 148, 20, 0, 0 ) constant LText19 = createEx( LText, "invisible check box below", TabItem2, 16, 48, 148, 20, 0, 0 ) constant PushButton20 = createEx( ToggleButton, "CLICK to make CheckBox vis or invis", TabItem1, 16, 92, 204, 28, 0, 0 ) --------------------------------------------------------- -------------------------------------------------------------------------------- procedure Window1_onActivate (integer self, integer event, sequence params)--params is () setVisible(CheckBox1, 0) setVisible(CheckBox2, 0) setVisible(CheckBox3, 0) end procedure setHandler( Window1, w32HActivate, routine_id("Window1_onActivate")) -------------------------------------------------------------------------------- procedure TabItem1_onClick (integer self, integer event, sequence params)--params is () setVisible(CheckBox1, 0) setVisible(CheckBox3, 0) end procedure setHandler( TabItem1, w32HClick, routine_id("TabItem1_onClick")) -------------------------------------------------------------------------------- procedure TabItem2_onClick (integer self, integer event, sequence params)--params is () setVisible(CheckBox2, 0) end procedure setHandler( TabItem2, w32HClick, routine_id("TabItem2_onClick")) -------------------------------------------------------------------------------- procedure PushButton20_onClick (integer self, integer event, sequence params)--params is () if isVisible(CheckBox1) then setVisible(CheckBox1, 0) setVisible(CheckBox3, 0) setVisible(Group21,0) -- <-- first change setVisible(Group21,1) -- <-- second change else setVisible(CheckBox1, 1) setVisible(CheckBox3, 1) end if end procedure setHandler( PushButton20, w32HClick, routine_id("PushButton20_onClick")) WinMain( Window1,Normal )
DanM
8. Re: Win32lib bug - Checkboxes become visible inside TabItems.
- Posted by wd40 Nov 11, 2009
- 1665 views
I re-did this because I left out something important.
Any control you put in layer 0 will not show up in layer 1, be it a CheckBox, TabItem or a Group.
In the case of the TabItem you will have to create 2 one for each layer.
I don't understand the button unless it's to prove things dosen't work right.
constant TheProgramType="exw" include Win32lib.ew without warning -------------------------------------------------------------------------------- -- Window Window1 global constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300, 0, 0 ) global constant TabControl2 = createEx( TabControl, "TabControl2", Window1, 136, 100, 148, 60, 0, 0 ) global constant TabItem3 = createEx( TabItem, "TabItemB", TabControl2, 0, 0, 0, 0, 0, 0 ) global constant TabItem4 = createEx( TabItem, "TabItemA", TabControl2, 0, 0, 0, 0, 0, 0 ) global constant TabControl7 = createEx( TabControl, "TabControl7", Window1, 136, 100, 148, 60, 0, 0 ) global constant TabItem11 = createEx( TabItem, "TabItemB", TabControl7, 0, 0, 0, 0, 0, 0 ) global constant TabItem8 = createEx( TabItem, "TabItemA", TabControl7, 0, 0, 0, 0, 0, 0 ) global constant CheckBox5 = createEx( CheckBox, "CheckBox5", TabItem3, 24, 36, 88, 20, 0, 0 ) global constant CheckBox6 = createEx( CheckBox, "CheckBox6", TabItem4, 48, 36, 80, 20, 0, 0 ) global constant CheckBox13 = createEx( CheckBox, "CheckBox13", TabItem11, 12, 32, 92, 20, 0, 0 ) global constant LText14 = createEx( LText, "You are looking at Layer 0 ", Window1, 80, 24, 148, 24, 0, 0 ) global constant LText15 = createEx( LText, "You are looking at Layer 1", Window1, 4, 8, 148, 20, 0, 0 ) global constant LText16 = createEx( LText, "TabItem 3 and 4 are hid n Layer 0", Window1, 84, 60, 180, 20, 0, 0 ) global constant LText17 = createEx( LText, "TabItewms 8 and 11 are hid in Layer 1", Window1, 80, 64, 200, 20, 0, 0 ) --------------------------------------------------------- setVisible({TabControl7,LText15,LText16},0) sequence IDE_labeltable ------------this is where you comtrol the visibilty of the comtrols------------------ IDE_labeltable = { ----------------layer 0 controls------------ {Window1,"Layer 0",CheckBox5}, {Window1,"Layer 0",CheckBox6}, {Window1,"Layer 0",TabControl2}, {Window1,"Layer 0",TabItem3}, {Window1,"Layer 0",TabItem4}, {Window1,"Layer 0",LText17},--I just now added {Window1,"Layer 0",LText14},--I just now added ----------- layer 1 controls---------------- {Window1,"Layer 1",CheckBox13}, {Window1,"Layer 1",TabControl7}, {Window1,"Layer 1",TabItem11}, {Window1,"Layer 1",TabItem8}, {Window1,"Layer 1",LText15},--I just now added {Window1,"Layer 1",LText16}--I just now added } function setLayerVisible(integer windowName,object layerName,integer state) integer foundIt foundIt=0 for i=1 to length(IDE_labeltable) do if sequence(layerName) then if equal(windowName,IDE_labeltable[i][1]) and equal(layerName,IDE_labeltable[i][2]) then setVisible(IDE_labeltable[i][3],state) foundIt=w32True elsif foundIt then exit end if else if equal(windowName,IDE_labeltable[i][1]) and layerName=i-1 then for j=1 to length(IDE_labeltable) do setVisible(IDE_labeltable[j][3],state) end for foundIt=w32True elsif foundIt then exit end if end if end for if foundIt then return 0 else return 1 end if end function function setLayerEnable(integer windowName,object layerName,integer state) integer foundIt foundIt=0 for i=1 to length(IDE_labeltable) do if sequence(layerName) then if equal(windowName,IDE_labeltable[i][1]) and equal(layerName,IDE_labeltable[i][2]) then setEnable(IDE_labeltable[i][3],state) foundIt=w32True elsif foundIt then exit end if else if equal(windowName,IDE_labeltable[i][1]) and layerName=i-1 then for j=1 to length(IDE_labeltable) do setEnable(IDE_labeltable[j][3],state) end for foundIt=w32True elsif foundIt then exit end if end if end for if foundIt then return 0 else return 1 end if end function -------------------------------------------------------------------------------- procedure TabItem3_onClick (integer self, integer event, sequence params)--params is () VOID=setLayerVisible(Window1,"Layer 0",0) VOID=setLayerVisible(Window1,"Layer 1",1) setFocus(TabItem11) end procedure setHandler( TabItem3, w32HClick, routine_id("TabItem3_onClick")) -------------------------------------------------------------------------------- procedure TabItem8_onClick (integer self, integer event, sequence params)--params is () VOID=setLayerVisible(Window1,"Layer 1",0) VOID=setLayerVisible(Window1,"Layer 0",1) setFocus(TabItem4) end procedure setHandler( TabItem8, w32HClick, routine_id("TabItem8_onClick")) -------------------------------------------------------------------------------- WinMain( Window1,Normal )
Don Cole