Thread: Dialog box redraw

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    29

    Question Dialog box redraw

    I think this is a fairly simple question, thus i'm not posting any code.

    My problem is as follows - I have a simple dialog box, with a static control that is holding text. I then have the text change, as events happen (like, for example, when a certain app starts, or when certain menus are chosen). The problem is, it does not redraw the text until I pass my cursor over the box, or otherwise bring focus to it.

    How can I force it to draw the text as soon as its changed? I assume its just a matter of forcing it to redraw.

    Any advice is very much appreciated

  2. #2
    Barjor
    Guest
    I don't know what compiler you use but if it is VC and MFC you can call UpdateData(TRUE) or UpdateData(FALSE) to either read or write variables to your dialog. So if you catch the OnChange message and add the line UpdateData(False) that will write your varibles back to your dialog
    ~Barjor

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    29
    sorry, forgot to add compiler info

    Borland C++Builder 5 Pro

    only WinAPI please, not using MFC.

  4. #4
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    use the handle to your static text control to call InvalidateRect()
    then call UpdateWindow() with it.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  5. #5
    Registered User
    Join Date
    Dec 2001
    Posts
    29
    Thanks for the suggestion Stoned, but that doesn't seem to be working

    No errors, just doesn't change anything.

  6. #6
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    post your code
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  7. #7
    Registered User
    Join Date
    Dec 2001
    Posts
    29

    Talking

    Nevermind, it worked.. I was just being stupid, got my handlers mixed up with InvalidateRect.

    Thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 02-13-2008, 02:59 PM
  2. Parent of a BrowseForFolder dialog box
    By @nthony in forum Windows Programming
    Replies: 4
    Last Post: 01-08-2007, 02:54 PM
  3. New Theme
    By XSquared in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 04-01-2004, 08:00 PM
  4. Dialog Box & Property Sheet :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 08-01-2002, 01:33 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM