Re: Win32lib bug - Checkboxes become visible inside TabItems.
- Posted by wd40 Nov 10, 2009
- 1681 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