RE: Lable covering up Text Box Mystery
- Posted by Brian Broker <bkb at cnw.com> Jan 08, 2004
- 390 views
Here's some advice: 1. Typically controls should only be created once, so just define them as constants. 2. Avoid making controls overlap each other. In your example, lablen=60 makes the label control overlap your edit box. 30 should be the max given the location of your SleText. 3. Never ever create controls in a paint event. You will create hundreds of overlapping controls if you happen to drag another window over yours. 4. Make sure you are both using the same version of Win32Lib. (double check that you are using what you *think* you are using by checking constant Win32LibVersion)... I only mention this because SleText is deprecated and now called an EditText. 5. What would you like to accomplish with the background color? Here's how I might write your demo: without warning include win32lib.ew integer flag,lablen flag=0 -- I don't think 10 is a valid flag and I would avoid using it -- see WS_ constants for valid flags lablen=30 -- avoid overlapping controls constant Win = create(Window,"Test",0,Center,Center,500,500,0), Tabs = create( TabControl, "", Win,0, 0, 500,500, 0 ), Tab1 = create( TabItem, "Patient",Tabs,0,0,0,0,0 ), OldFont = setCreateFont("Courier New",11,Normal,Black), Lbl11 = create(LText,"Age",Tab1,30,50,lablen,25,flag), Age = create(EditText,"", Tab1,60,50,30,25,0) procedure init( integer self, integer event, sequence params) -- initialization things should go in w32HOpen event -- but why do this? Tab control is covering blue window anyway setWindowBackColor(Win,SkyBlue) end procedure setHandler(Win, w32HOpen, routine_id( "init" )) WinMain(Win,Normal) Ron Austin wrote: > > > My brother and I are working on a project. He recently sent me his > latest version which was missing three or four text boxes. I called him > > and he said he could see them just fine. We are both using WinXP Home > and both have 1024 X 768 display. Here's a test program I made to > illustrate the problem: > > without warning > include win32lib.ew > integer Lbl11,Tabs,Tab1,flag,Age,lablen > > flag=0 -- flag=10 allows win color to bleed through? > lablen=60 -- this setting covers causes the lable to cover up the Age > control. Change it to 30 and try it > > constant win=createEx (Window,"Test",0,Center,Center,500,500,0,0) > setWindowBackColor(win,SkyBlue) > Tabs = create ( TabControl, "", win,0, 0, 500,500, 0 ) > Tab1 = create( TabItem, "Patient", Tabs,0,0,0,0,0) > procedure print_it( integer self, integer event, sequence params) > sequence OldFont > > OldFont = setCreateFont("Courier New",11,Normal,Black) > Lbl11 = create(LText,"Age", Tab1,30, > 50,lablen,25,flag) > Age = create(SleText,"", Tab1,60,50,30,25,0) > end procedure > setHandler(win, w32HPaint, routine_id( "print_it" )) > WinMain(win,Normal) > > With lablen set to 60 the label is covering up the text box. If I > change it to 30 than I can see the text box. > > My brother discovered that if he sets flag=10 it allows the main window > color to show through the tab. When he did that it shows the blue color > > on both sides of the text box, but the box is still visable. When I try > > it the entire text box is covered up with the blue. Can someone please > explain what is happening here? Could it have something to do with our > respective video cards? >