Owner drawn edit text; flickers.

This is a discussion on Owner drawn edit text; flickers. within the Windows Programming forums, part of the Platform Specific Boards category; I placed a TextOut() in WM_PAINT for an edit control. It draws the text, but the text flickers constantly, very ...

  1. #1
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401

    Owner drawn edit text; flickers.

    I placed a TextOut() in WM_PAINT for an edit control. It draws the text, but the text flickers constantly, very quickly. Is there a window style or similar that I have to use?

    Code:
    case WM_PAINT:
    	{
    		HDC hdc=GetDC(hwnd);
    		TextOut(hdc,0,0,"yo",2);
    		ReleaseDC(hwnd,hdc);
    	}
    	return 0;
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  2. #2
    Master of the Universe! velius's Avatar
    Join Date
    Sep 2003
    Posts
    219
    You may be updating the control too frequently. And besides why are you painting text to an Edit Control when you type in it. You should use SetWindowText() instead.
    Last edited by velius; 10-08-2003 at 06:36 AM.
    While you're breakin' down my back n'
    I been rackin' out my brain
    It don't matter how we make it
    'Cause it always ends the same
    You can push it for more mileage
    But your flaps r' wearin' thin
    And I could sleep on it 'til mornin'
    But this nightmare never ends
    Don't forget to call my lawyers
    With ridiculous demands
    An you can take the pity so far
    But it's more than I can stand
    'Cause this couchtrip's gettin' older
    Tell me how long has it been
    'Cause 5 years is forever
    An you haven't grown up yet
    -- You Could Be Mine - Guns N' Roses

  3. #3
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    I need to draw things into the edit control that are not really text based, so I thought I'd make it completely owner drawn.

    How can I stop it updating so much?
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  4. #4
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Problem fixed, I had to validate after drawing:

    Code:
    case WM_PAINT:
    	{
    		HDC hdc=GetDC(hwnd);
    		TextOut(hdc,0,0,"text",3);
    		ReleaseDC(hwnd,hdc);
    		ValidateRect(hwnd,NULL);
    	}
    	return 0;
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  5. #5
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Why don't you use BeginPaint and EndPaint which handle validation?

  6. #6
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    I've never really done painting so I didn't know it handled it. I'm using it now, works fine, thanks. But now I'm more concerned about my other problem, in the other thread I posted (PLUG PLUG PLUG).
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Adding text to a disabled edit box
    By osal in forum Windows Programming
    Replies: 1
    Last Post: 06-16-2004, 02:23 PM
  2. Getting my text from edit box
    By Marky_Mark in forum Windows Programming
    Replies: 2
    Last Post: 11-16-2001, 01:06 PM
  3. How do I put text in a specified spot of an EDIT box?(PLEASE READ!)
    By SyntaxBubble in forum Windows Programming
    Replies: 5
    Last Post: 11-10-2001, 07:55 AM
  4. How do I get text from an edit box?
    By Strider in forum Windows Programming
    Replies: 3
    Last Post: 11-05-2001, 05:43 PM
  5. adding text to an edit control
    By steve_i83 in forum Windows Programming
    Replies: 2
    Last Post: 10-26-2001, 07:40 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21