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