1. disappearing text in child window
- Posted by DanM Apr 19, 2009
- 977 views
Below is demo stub for minor problem I'm encountering.
It has two windows, one is child of first, and child has text written to it on activate.
But some few seconds after activation, I regularly hear some hard disk activity,
and the text disappears.
What's up with that?
I know I can make the text reappear "onPaint" the child window,
but that still shows a momentary flicker of the window, which I don't like,
and I'm wondering WHY does the text disappear in the first place,
and what causes the window to flicker when I'm not doing anything
programmatically?
Dan (demo follows)
-- code generated by Win32Lib IDE v0.20.1 include Win32lib.ew without warning -------------------------------------------------------------------------------- -- Window Window1 constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300, 0, 0 ) --------------------------------------------------------- -------------------------------------------------------------------------------- -- Window Window2 sequence IDEFlags IDEFlags = classDefaults(Window, { {1, {WS_SYSMENU,WS_MINIMIZEBOX,WS_MAXIMIZEBOX}},{2, {WS_EX_DLGMODALFRAME}} } ) constant Window2 = createEx( Window, "Window 2", Window1, Default, Default, 331, 195, {WS_CHILD, WS_CLIPSIBLINGS, WS_BORDER, WS_DLGFRAME, WS_THICKFRAME, WS_CAPTION, WS_SYSMENU, WS_MINIMIZEBOX, WS_MAXIMIZEBOX}, {WS_EX_DLGMODALFRAME} ) moveZOrder( Window2, HWND_TOP) --------------------------------------------------------- -------------------------------------------------------------------------------- procedure Window1_onActivate (integer self, integer event, sequence params)--params is () openWindow(Window2, Normal) end procedure setHandler( Window1, w32HActivate, routine_id("Window1_onActivate")) -------------------------------------------------------------------------------- procedure Window2_onActivate (integer self, integer event, sequence params)--params is () wPuts(Window2, "here is some text") end procedure setHandler( Window2, w32HActivate, routine_id("Window2_onActivate")) WinMain( Window1,Normal )
2. Re: disappearing text in child window
- Posted by DerekParnell (admin) Apr 19, 2009
- 964 views
But some few seconds after activation, I regularly hear some hard disk activity, and the text disappears.
What's up with that?
I know I can make the text reappear "onPaint" the child window, but that still shows a momentary flicker of the window ...
I tried your exact code on my system and getting no issues at all. The text does not disappear. Also, when I added the Paint handler, I did not get any flicker either.
I'm using Windows XP SP2 with Eu 4.0 alpha svn 1952.
3. Re: disappearing text in child window
- Posted by DanM Apr 19, 2009
- 972 views
Derek,
I should've saved time and noted: I'm using XP SP3, Win32Lib 0.60.6, Eu 2.5
Dan
4. Re: disappearing text in child window
- Posted by ghaberek (admin) Apr 21, 2009
- 985 views
Below is demo stub for minor problem I'm encountering. It has two windows, one is child of first, and child has text written to it on activate.
But some few seconds after activation, I regularly hear some hard disk activity, and the text disappears.
What's up with that?
I know I can make the text reappear "onPaint" the child window, but that still shows a momentary flicker of the window, which I don't like, and I'm wondering WHY does the text disappear in the first place, and what causes the window to flicker when I'm not doing anything programmatically?
Dan
When you call wPuts(), you're drawing the text on the Window at that time. The next time a Paint event comes along, it "repaints" the Window blank again. This is why you need to put your drawing code into the Paint event, so the content is always drawn back to the window. If you're looking to just place static text on a Window, you should use a label control (LText) control instead.
-Greg
P.S. When posting in the EUforum, you do not need to insert line breaks () manually unless you want to add more lines. Simply type your text and insert a blank line to separate paragraphs. The text will wrap automatically. If you Quote with Reply to my post, you'll see what I mean.
5. Re: disappearing text in child window
- Posted by DanM Apr 23, 2009
- 972 views
Below is demo stub for minor problem I'm encountering. It has two windows, one is child of first, and child has text written to it on activate.
But some few seconds after activation, I regularly hear some hard disk activity, and the text disappears.
What's up with that?
I know I can make the text reappear "onPaint" the child window, but that still shows a momentary flicker of the window, which I don't like, and I'm wondering WHY does the text disappear in the first place, and what causes the window to flicker when I'm not doing anything programmatically?
Dan
When you call wPuts(), you're drawing the text on the Window at that time. The next time a Paint event comes along, it "repaints" the Window blank again. This is why you need to put your drawing code into the Paint event, so the content is always drawn back to the window. If you're looking to just place static text on a Window, you should use a label control (LText) control instead.
-Greg
P.S. When posting in the EUforum, you do not need to insert line breaks () manually unless you want to add more lines. Simply type your text and insert a blank line to separate paragraphs. The text will wrap automatically. If you Quote with Reply to my post, you'll see what I mean.
Thanks for responding Greg!
I'll look at using a label, not sure at this point if that will completely suffice.
But what really confuses me is that the text disappearing seems to be somewhat specific to *my* system, as it *doesn't* disappear for Derek running my demo code. Does my demo disappear for you? For me, it disappears, that is, there must be as you said, a Paint event asserted, at exactly the same moment that I hear a hard disk access, but with no *programmatic* event occurring to assert the Paint event.
And the reason I put \\ at the end of my lines in the original post is because the demo code did not wrap, so when I read my own post and probably any responses, the wrapping of both my text and any responses go out as far as the longest line of code, so I have to scroll sideways over to read every line of response, which is a hassle, so I make my post have "shorter" lines by forcing line breaks. I guess that doesn't help me to read responses, as they'll probably auto-use the longest line as a limit to wrap to, but at least I don't have to scroll sideways to read each line of my own post. This may also be an artifact of my browsers setting for font size. It doesn't hurt to force line breaks, right?
Dan
6. Re: disappearing text in child window
- Posted by ghaberek (admin) Apr 23, 2009
- 938 views
Thanks for responding Greg!
I'll look at using a label, not sure at this point if that will completely suffice.
But what really confuses me is that the text disappearing seems to be somewhat specific to *my* system, as it *doesn't* disappear for Derek running my demo code. Does my demo disappear for you? For me, it disappears, that is, there must be as you said, a Paint event asserted, at exactly the same moment that I hear a hard disk access, but with no *programmatic* event occurring to assert the Paint event.
I see. Perhaps you have a program running that is trigger a repaint to the entire desktop when it does something with the disk?
And the reason I put \\ at the end of my lines in the original post is because the demo code did not wrap, so when I read my own post and probably any responses, the wrapping of both my text and any responses go out as far as the longest line of code, so I have to scroll sideways over to read every line of response, which is a hassle, so I make my post have "shorter" lines by forcing line breaks. I guess that doesn't help me to read responses, as they'll probably auto-use the longest line as a limit to wrap to, but at least I don't have to scroll sideways to read each line of my own post. This may also be an artifact of my browsers setting for font size. It doesn't hurt to force line breaks, right?
I suppose
not. It just
looks really
weird.
-Greg
7. Re: disappearing text in child window
- Posted by DanM Apr 23, 2009
- 943 views
- Last edited Apr 24, 2009
Thanks for responding Greg!
I'll look at using a label, not sure at this point if that will completely suffice.
But what really confuses me is that the text disappearing seems to be somewhat specific to *my* system, as it *doesn't* disappear for Derek running my demo code. Does my demo disappear for you? For me, it disappears, that is, there must be as you said, a Paint event asserted, at exactly the same moment that I hear a hard disk access, but with no *programmatic* event occurring to assert the Paint event.
I see. Perhaps you have a program running that is trigger a repaint to the entire desktop when it does something with the disk?
That's a good observation, I'll see if I can find out.
And the reason I put \\ at the end of my lines in the original post is because the demo code did not wrap, so when I read my own post and probably any responses, the wrapping of both my text and any responses go out as far as the longest line of code, so I have to scroll sideways over to read every line of response, which is a hassle, so I make my post have "shorter" lines by forcing line breaks. I guess that doesn't help me to read responses, as they'll probably auto-use the longest line as a limit to wrap to, but at least I don't have to scroll sideways to read each line of my own post. This may also be an artifact of my browsers setting for font size. It doesn't hurt to force line breaks, right?
I suppose
not. It just
looks really
weird.
-Greg
Well, of course your example looks really weird,
but the way I break lines up is just by phrases, or sentences,
so it doesn't look that weird!
(I'm using slightly larger fonts, so maybe with smaller ones
it does look weird?)
But you can read this without having to scroll sideways,
unlike the following:
see, here is a really long line of text, could be a line of code of course, which even though you have to scroll sideways to read this, you DON'T have to scroll sideways to read the above.Dan
