1. Why Does Child Window Disappear?
- Posted by "C. K. Lester" <cklester at yahoo.com> Jan 21, 2003
- 436 views
When I show a child window, it displays okay. When I show a child window with a changing label, it loses its border definition. I'm pasting below some code that shows what I mean... Comment/Uncomment the pair of lines down toward the bottom that say -- if 1=1 then -- use this line to see a bad child window if 1=2 then -- use this line to see a good child window I just need help setting things up so the window doesn't lose its look during the rapid label text updating that will occur in the final program... Thanks in advance! -ck ----------------------------- --TEST CODE BEGINS ----------------------------- -- code generated by Win32Lib IDE v0.15.0 include Win32lib.ew include center.ew without warning ---------------------------------------------------------------------------- ---- -- Window mainWin constant mainWinSizeX = 450, mainWinSizeY = 357, msgWinSizeX = mainWinSizeX/2, msgWinSizeY = mainWinSizeY/5 constant mainWin = createEx( Window, "Forms On-A-Disk Install Maker", 0, Default, Default, mainWinSizeX, mainWinSizeY, {WS_DLGFRAME}, 0 ) constant msgX = (mainWinSizeX-msgWinSizeX)/2, msgY = (mainWinSizeY-msgWinSizeY)/2 constant msgWindow = createEx( Window, "", mainWin, msgX, msgY, msgWinSizeX, msgWinSizeY, {WS_CHILD, WS_DLGFRAME}, 0 ) constant lbl_Message = createEx( LText, "Making disk...", msgWindow, msgWinSizeX*.05, (msgWinSizeY-20)/2, msgWinSizeX*.8, 20, 0, 0 ) constant TabControl2 = createEx( TabControl, "TabControl2", mainWin, 0, 28, 440, 300, 0, 0 ) constant tab_Step3 = createEx( TabItem, "Step 3", TabControl2, 0, 0, 0, 0, 0, 0 ) constant grp_MSWVersion = createEx( Group, "Microsoft Word Version", tab_Step3, 20, 40, 160, 112, 0, 0 ) constant rad_97 = createEx( Radio, "97", grp_MSWVersion, 24, 24, 52, 20, 0, 0 ) constant rad_2000 = createEx( Radio, "2000", grp_MSWVersion, 24, 48, 52, 20, 0, 0 ) constant rad_2002 = createEx( Radio, "XP (2002)", grp_MSWVersion, 24, 72, 72, 20, 0, 0 ) constant bttn_makeDisk = createEx( PushButton, "Make Disk", tab_Step3, 336, 256, 88, 28, 0, 0 ) constant bttn_Step2Prev = createEx( PushButton, "< Previous", tab_Step3, 240, 256, 88, 28, 0, 0 ) constant bttn_Cancel3 = createEx( PushButton, "Cancel", tab_Step3, 144, 256, 88, 28, 0, 0 ) procedure setMsg( sequence text ) -- this procedure simply sets the text of the message label on the msgWindow setText( lbl_Message, text ) end procedure procedure pause( atom seconds ) seconds += time() while seconds > time() do end while end procedure -- openWindow(msgWindow, Normal) setVisible( msgWindow, False ) setFocus( tab_Step3 ) centerWindow( mainWin ) openWindow(mainWin, Normal) ---------------------------------------------------------------------------- ---- procedure bttn_Cancel3_onClick (integer self, integer event, sequence params)--params is () -- confirm -- stop the program closeWindow( mainWin ) end procedure setHandler( bttn_Cancel3, w32HClick, routine_id("bttn_Cancel3_onClick")) ---------------------------------------------------------------------------- ---- procedure bttn_makeDisk_onClick (integer self, integer event, sequence params)--params is () setVisible( msgWindow, True ) -- if 1=1 then -- use this line to see a bad child window if 1=2 then -- use this line to see a good child window for t=1 to 10 do setMsg( sprintf("This is message #%d",{t}) ) pause(.5) end for setMsg( "" ) setVisible( msgWindow, False ) end if end procedure setHandler( bttn_makeDisk , w32HClick, routine_id("bttn_makeDisk_onClick")) WinMain( mainWin,Normal ) ----------------------------- --TEST CODE ENDS -----------------------------
2. Re: Why Does Child Window Disappear?
- Posted by "C. K. Lester" <cklester at yahoo.com> Jan 22, 2003
- 430 views
On Tuesday 21 January 2003 04:04 pm, you wrote: > > C. K. Lester wrote: > > When I show a child window, it displays okay. > > When I show a child window with a changing label, it loses its border > > definition. > > Windows doesn't like busy-loops like your "pause" function. You are > needlessing spinning away doing nothing but chewing CPU time that could > be used to draw your window properly. Try using a timer... I'm not at work right now, but I'll do the best I can: I get the SAME disappearing window trick when I don't use pause() but whe= n I=20 change the label (lbl_Message?). Try this: In the msg_Window, loop through a long sequence of strings and assign the= m to=20 the lbl_Message... You can make actually just show the same string... or=20 random strings. You might have to loop through quite a few, but the windo= w=20 will still disappear. I'm trying to post different messages to the msg_Wi= ndow=20 as the program progresses, to let the user know what's goin' on... I hope this made sense. If not, I'll be back at work tomorrow and will=20 resume... :)
3. Re: Why Does Child Window Disappear?
- Posted by "C. K. Lester" <cklester at yahoo.com> Jan 22, 2003
- 415 views
> Windows doesn't like busy-loops like your "pause" function. You are > needlessing spinning away doing nothing but chewing CPU time that could > be used to draw your window properly. Try using a timer... Look at this code... No "busy-loops." How else would you program it so that the child window SHOWS UP and is displayed by Winblows while the counter increases? ---TEST CODE BEGINS -- code generated by Win32Lib IDE v0.15.0 include Win32lib.ew without warning ---------------------------------------------------------------------------- ---- -- Window testWin constant testWin = createEx( Window, "Label Change Test", 0, Default, Default, 261, 150, 0, 0 ) constant PushButton3 = createEx( PushButton, "PushButton3", testWin, 160, 92, 88, 28, 0, 0 ) constant CWindow4 = createEx( Window, "CWindow4", testWin, 12, 8, 204, 76, or_all({WS_CHILD}), 0 ) openWindow(CWindow4, Normal) setVisible( CWindow4, False ) constant LText2 = createEx( LText, "LText2", CWindow4, 24, 12, 148, 20, 0, 0 ) --------------------------------------------------------- procedure PushButton3_onClick (integer self, integer event, sequence params)--params is () setVisible( CWindow4, True ) for t=1 to 10000 do setText( LText2, sprintf("This is message #%d",{t}) ) end for end procedure setHandler( PushButton3, w32HClick, routine_id("PushButton3_onClick")) WinMain( testWin,Normal ) ---TEST CODE ENDS
4. Re: Why Does Child Window Disappear?
- Posted by gertie at visionsix.com Jan 22, 2003
- 422 views
On 22 Jan 2003, at 11:14, C. K. Lester wrote: > > > Windows doesn't like busy-loops like your "pause" function. You are > > needlessing spinning away doing nothing but chewing CPU time that could > > be used to draw your window properly. Try using a timer... > > Look at this code... No "busy-loops." How else would you program it so that > the > child window SHOWS UP and is displayed by Winblows while the counter > increases? Smaller for loop and a sleep(x)? The for loop will run at different speeds on different systems and different cpu loads, while a sleep(1) will last one second anywhere. Of course, i don't know if that's what you want. Kat
5. Re: Why Does Child Window Disappear?
- Posted by "C. K. Lester" <cklester at yahoo.com> Jan 22, 2003
- 411 views
> > > Windows doesn't like busy-loops like your "pause" function. You are > > > needlessing spinning away doing nothing but chewing CPU time that could > > > be used to draw your window properly. Try using a timer... > > > > Look at this code... No "busy-loops." How else would you program it so that the > > child window SHOWS UP and is displayed by Winblows while the counter increases? > > Smaller for loop and a sleep(x)? What if I can't go smaller? What if I'm doing 10000 steps and want to report on each step? The point is, I don't care what I'm having to do, Windows needs to display the stuff properly! Or I need to know what to do so it is displayed properly...
6. Re: Why Does Child Window Disappear?
- Posted by "C. K. Lester" <cklester at yahoo.com> Jan 22, 2003
- 404 views
> When I'm doing some processor intense stuff, I like to create a little > window with a progress bar, updating it where appropriate, and every so > often calling doEvents(), which allows things to move and repaint as needed. > It keeps your app from looking dead to the user. Matt, I put a doEvents(0) just after the loop command... for t=1 to 10000 do doEvents(0) ... end for and it looks MUCH better. :) Thanks for the heads-up...
7. Re: Why Does Child Window Disappear?
- Posted by "C. K. Lester" <cklester at yahoo.com> Jan 22, 2003
- 398 views
> > The point is, I don't care what I'm having to do, Windows needs to > > display > > the stuff properly! Or I need to know what to do so it is displayed > > properly... > > > > I gave you an example of using a timer... does this not cut it for you? Hey, Brian, thanks for your help. Timer doesn't work for me in this particular case. If I want to update the text of a control 10000 times per second, then I should be able to do that without Winblows playing dumb. I put a doEvents() in the loop and it works (looks) fine now! :) Thanks! -ck
8. Re: Why Does Child Window Disappear?
- Posted by cafromsw at yahoo.com Jan 22, 2003
- 417 views
I was just playing around with your code and this seemed to work for me. Does anyone know if it is any better or worse than using doEvents(0) in the loop? REM the openWindow() and setVisible() lines that are right below CWindow4=createEx() REM setVisible( CWindow4, True ) that is in the PushButton3_onClick() routine and right below that line add openWindow(CWindow4, Normal) REM doEvents(0) When I run the code like that it opens the child and diplays the counter. Will that work in your application? Plus you could put code into the CWindow4_onOpen procedure to run whenever the window opened. I do have one question though, why is the variable t in sequence brackets {} in setText when it seems to works fine without them? setText( LText2, sprintf("This is message#%d",{t}) ) setText( LText2, sprintf("This is message#%d",t) ) Chris cafromsw at yahoo.com --- "C. K. Lester" <cklester at yahoo.com> wrote: > > > Windows doesn't like busy-loops like your "pause" > function. You are > > needlessing spinning away doing nothing but > chewing CPU time that could > > be used to draw your window properly. Try using a > timer... > > Look at this code... No "busy-loops." How else would > you program it so that > the child window SHOWS UP and is displayed by > Winblows while the counter > increases? > > ---TEST CODE BEGINS > -- code generated by Win32Lib IDE v0.15.0 > > include Win32lib.ew > without warning > > > Default, 261, 150, 0, 0 ) > constant PushButton3 = createEx( PushButton, > "PushButton3", testWin, 160, > 92, 88, 28, 0, 0 ) > constant CWindow4 = createEx( Window, "CWindow4", > testWin, 12, 8, 204, 76, > or_all({WS_CHILD}), 0 ) > openWindow(CWindow4, Normal) > setVisible( CWindow4, False ) > constant LText2 = createEx( LText, "LText2", > CWindow4, 24, 12, 148, 20, 0, > 0 ) > > > procedure PushButton3_onClick (integer self, integer > event, sequence > params)--params is () > setVisible( CWindow4, True ) > for t=1 to 10000 do > setText( LText2, sprintf("This is message > #%d",{t}) ) > end for > end procedure > setHandler( PushButton3, w32HClick, > routine_id("PushButton3_onClick")) > > WinMain( testWin,Normal ) > > ---TEST CODE ENDS > > > > > TOPICA - Start your own email discussion group. > FREE! > > >
9. Re: Why Does Child Window Disappear?
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jan 23, 2003
- 471 views
On Wed, 22 Jan 2003 11:14:55 -0600, "C. K. Lester" <cklester at yahoo.com> wrote: >Look at this code... No "busy-loops." How else would you program it so = that >the child window SHOWS UP and is displayed by Winblows while the counter >increases? doEvents(0) in the loop worked fine for me. Pete
10. Re: Why Does Child Window Disappear?
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jan 23, 2003
- 421 views
On Wed, 22 Jan 2003 11:58:01 -0800 (PST), cafromsw at yahoo.com wrote: >I do have one question though, why is the variable t >in sequence brackets {} in setText when it seems to >works fine without them? >setText( LText2, sprintf("This is message#%d",{t}) ) >setText( LText2, sprintf("This is message#%d",t) ) Convention: while sprintf("text %d", 2) and sprintf("text %d",{2}) will both produce "text 2", if you code sprintf("text %s","test") and sprintf("text %s",{"test"}), then (as documented in the euphoria reference manual) the first will unexpectedly produce "text t", whereas the second (the more likely wanted) "text test". Also, if your format string has more than one '%d' or '%s' etc, you need to use the {} to pass the fields as one parameter. Since you often need the {}, and sometimes omitting them gives the wrong answer, it is easiest just to always get used to using them. Like everything else, easy once you get used to it. Pete
11. Re: Why Does Child Window Disappear?
- Posted by cafromsw at yahoo.com Jan 23, 2003
- 446 views
Thanks, I'll keep that in mind next time I need to sprintf() Chris cafromsw at yahoo.com --- Pete Lomax <petelomax at blueyonder.co.uk> wrote: > > On Wed, 22 Jan 2003 11:58:01 -0800 (PST), > cafromsw at yahoo.com wrote: > > >I do have one question though, why is the variable > t > >in sequence brackets {} in setText when it seems to > >works fine without them? > >setText( LText2, sprintf("This is message#%d",{t}) > ) > >setText( LText2, sprintf("This is message#%d",t) ) > > Convention: while sprintf("text %d", 2) and > sprintf("text %d",{2}) > will both produce "text 2", if you code > sprintf("text %s","test") and > sprintf("text %s",{"test"}), then (as documented in > the euphoria > reference manual) the first will unexpectedly > produce "text t", > whereas the second (the more likely wanted) "text > test". > > Also, if your format string has more than one '%d' > or '%s' etc, you > need to use the {} to pass the fields as one > parameter. > > Since you often need the {}, and sometimes omitting > them gives the > wrong answer, it is easiest just to always get used > to using them. > > Like everything else, easy once you get used to it. > > Pete > > ==^^=============================================================== > This email was sent to: cafromsw at yahoo.com > > > TOPICA - Start your own email discussion group. > FREE! > > ==^^=============================================================== >