Re: TabItem and controls as array
- Posted by g.haberek at comcast.net Sep 15, 2002
- 401 views
this may help: ok, you've created your 29 tabs, but you're done using #20. it still exists in your array as my_tabs[20], simple solution: setEnable( my_tabs[20], False ) then in your loop: for x = 1 to length(my_tabs) do if isEnabled( my_tabs[x] ) then -- do stuff here end if end for hope this helps! ~Greg ----- Original Message ----- From: Derek Parnell <ddparnell at bigpond.com> To: EUforum <EUforum at topica.com> Sent: Sunday, September 15, 2002 9:42 AM Subject: Re: TabItem and controls as array > > Just a note to people using Win32lib. > > You must not make any assumptions on the sequence of numbers used in > creating control ids. > > For example: > > fld1 = create(...) > fld2 = create(...) > > You cannot assume that fld2 will be (fld1 + 1). > > Up until recently, the probabilty would that ids are created sequentially, > but that is definitely not the case with the next win32lib version. > > Consequently, code like this ... > > for i = fld1 to fld4 do ... > > is meaningless and should be avoided. > > An alternate way is this... > > sequence xx > xx = {fld1, fld2, fld3, fld4} > for i = 1 to length(xx) do > workon(xx[i]) > end for > > ---------------- > cheers, > Derek Parnell > ----- Original Message ----- > From: "Judith Evans" <camping at txcyber.com> > To: "EUforum" <EUforum at topica.com> > Sent: Monday, September 16, 2002 1:52 AM > Subject: RE: TabItem and controls as array > > > > Since this ran ok with win32lib v0.57.9 but not with later versions, I'm > > going to work with Derek directly on this one and not via Topica. > > > > > > Derek Parnell wrote: > > > Judith, > > > I'm unclear on one point. > > > > > > How are the control IDs getting into this array? > > > > > > I ask this because if you are using findChildren(TabItemX) you will get > > > all > > > controls that are in the TabControl, not just the TabItem you specified. > > > > > > If, however, you are explicitly placing the items created for a given > > > tabitem, then I'm at a loss to explain the effect. > > > > > > Is it possible you can supply a small test program that demostrates the > > > problem? > > > > > > ---------------- > > > cheers, > > > Derek Parnell > > > ----- Original Message ----- > > > From: "Judith Evans" <camping at txcyber.com> > > > To: "EUforum" <EUforum at topica.com> > > > Sent: Sunday, September 15, 2002 8:32 PM > > > Subject: TabItem and controls as array > > > > > > > > > > Maybe someone can give me a tip. > > > > > > > > I've got a TabControl with many TabItems. On one tab I have a set of > 29 > > > > controls. The information that goes into these controls is variable so > > > > the easy way to deal with them is to treat the controls as an array. > In > > > > my program I can then say things like for i=control_1 to control_nn > > > > do.... or setText(control_1+5, "something") > > > > > > > > What is happening is that controls from other tabs, which happen to be > > > > on their tabs positioned within the x,y range of the controls I am > > > > dealing with, get picked up in the for loop. I'm guessing to win32lib > or > > > > windows all the controls are really on the TabControl; otherwise I can > > > > not explain what is happening. > > > > > > > > Instead of using 29 statements to load the controls, does anyone have > an > > > > idea around this problem? > > > > > > > > > > >