1. Lable covering up Text Box Mystery
- Posted by Ron Austin <ronaustin at alltel.net> Jan 08, 2004
- 376 views
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?
2. Re: Lable covering up Text Box Mystery
- Posted by "Derek Parnell" <ddparnell at bigpond.com> Jan 08, 2004
- 386 views
----- Original Message ----- From: "Ron Austin" <ronaustin at alltel.net> To: <EUforum at topica.com> Subject: Lable covering up Text Box Mystery > > > 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? > You are doing a few unorthodox things here. I think that what you are Trying to do is give the label a blue background. Here is some code that does this better. The length of the label, when set to 60 means that it would overlay the edit box, so its not suprising that you can't see the editbox which is underneath the label. Note, the label is NOT transparent. Creating controls within a paint handler will cause problems later on. It is not recommended. ------------- without warning include win32lib.ew integer win, Lbl11,Tabs,Tab1,flag,Age,lablen,labhgt -- flag=10 allows win color to bleed through? -- Yes it does. This flags defines the label under user control, meaning you have to -- explictly draw what you want to see. flag=SS_USERITEM --10 lablen=90 -- I've changed to to 90 to show you the effect better. labhgt=35 -- Create the controls ONCE, not every time the window gets repainted. win=createEx (Window,"Test",0,Center,Center,500,500,0,0) Tabs = create ( TabControl, "", win,0, 0, 500,500, 0 ) Tab1 = create( TabItem, "Patient", Tabs,0,0,0,0,0) Lbl11 = create(LText,"", Tab1,30, 45,lablen,labhgt,flag) Age = create(SleText,"", Tab1,60, 50,30,25,0) -- Change the font for just the controls you want, not all controls. setFont(Lbl11,"Courier New",11,Normal) setFont(Age,"Courier New",11,Normal) -- Ensure 'Age' is on top of its label. moveZOrder(Age, HWND_TOP) procedure print_it( integer self, integer event, sequence params) sequence lExtent sequence lTextSize -- Get the current size of the label. lExtent = getCtlSize( Lbl11) -- Set the color to use as blue. setPenColor(Lbl11, SkyBlue) -- Paint a blue rectangle over the entire label drawRectangle(Lbl11,1, 0, 0, lExtent[1],lExtent[2]) -- Get the size of the text lTextSize = getTextExent(Lbl11, "Age") -- Now paint on the text for the label (vertically centered) wPuts({Lbl11, 1, floor((lExtent[2] - lTextExtent[2])/2) -1 }, "Age") end procedure setHandler(win, w32HPaint, routine_id( "print_it" )) WinMain(win,Normal)
3. Re: Lable covering up Text Box Mystery
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jan 09, 2004
- 393 views
On Thu, 8 Jan 2004 16:55:00 +0000, Ron Austin <ronaustin at alltel.net> wrote: >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? Use setVisible to turn the display of a control on or off rather than overpaint it. One difference between you and your brothers system might be the large/small/tiny font settings or the windows scheme even. It tends to be dismally disappointing when you finally figure out what the actual difference is, in these sort of cases. If I were in your position, I would take pains to make every possible thing different between the two machines, so you double the testing. I would not be asking "Why the difference?", but instead be thinking "What can I write that works acceptably on both?" (but then, I'm not you, and I'll add that it's fine to ask such questions here) Pete