Re: WinLib32 and tab controls
- Posted by Mike777 <anon4321 at ?mai?.com> Jan 16, 2008
- 603 views
CChris wrote: > > Mike777 wrote: > > > > What is the proper method to open a window with a tab control and 4 tabs, > > and > > ensure that the controls for only the selected tab are visible? > > > > I have a main window which has a menu item (Configure) which, when clicked: > > > > setVisible(Window1,w32False) > > setVisible(ConfigureWindow,w32True) > > > > On the Configure window I have four controls: > > > > TabControl96 > > cmdCancel > > cmdApply > > cmdSaveAndExit > > > > When I select Configure from the main window, ConfigureWindow opens and > > TabControl96 > > is visible. However, the controls associated with all the tab items > > (tbiOne, > > tbiTwo, tbiThree) are *all* visible. > > > > I have tried various combinations of making it work as one might expect, > > such > > as setting all of the subcontrol defaults to not visible and then making > > them > > visible when the tbiXXXX is clicked, but nothing works as I would expect. > > > > What I'm looking for is to have the focus set to a specific page (tbiOne) > > and > > then to have only those controls which have tbiOne as a parent to be > > visible. > > Then, when I click on the other tab items, to have the original tab item's > > controls disappear and the ones associated with the new tab show up. > > [Something > > tells me I didn't really need to type this last paragraph.] > > > > Again, is there an accepted way of handling the UI on such a design? > > > > Thanks > > > > Mike > > This had been a long standing bug in earlier versions of win32lib, but it is > corrected in v0.70.1 and later. Well, I *think* I'm using 70.2. > Normally, TabControl96 should be a child of ConfigureWindow It is. > cmsCancel a son > of tbiOne No, cmdCancel, cmdApply and cmdSaveAndExit are children of ConfigureWindow as they are the same routines on every "page" of the tab control. No sense repeating the controls. > and so forth, all of them visible. I have plenty of other controls that fill the bill of being children of the tbi's. > As a result, only the control on > the selected tab is visible. I agree that is the desired affect. > The tab last created is active by default. That doesn't work for me. > You > can change that by specifying an initial focus when you > openDialog(ConfigureWindow), Thanks for point that out. It works as advertised. And a byproduct is that the other issue is fixed at the same time and only the controls on the specific tab selected are visible. I knew that the "accepted" way of doing this would make it work. And it does. > or by creating last the item you want to see first (you can set the index of > a tabitem at the time you create it). > Still doesn't work? > Check the tabcontrol.exw demo, the last tab shows something which definitely > looks like yours, and on my machine I see only one button at a time. That demo works as expected on my machine. However, since I'm using the IDE to generate the code file, I wouldn't be able to easily make changes that aren't contemplated by the IDE. I mean, I *can* do it and occasionally I generate the code file and reorder things so that all references are good, but I usually go back later and figure out how to tweak the IDE so that it is not necessary to do this on a "final". Thanks again. Mike