Clearing the screen

This is a discussion on Clearing the screen within the C++ Programming forums, part of the General Programming Boards category; Im not sure if this is the right forum, but ill ask anyway. I have a program which creates a ...

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    39

    Clearing the screen

    Im not sure if this is the right forum, but ill ask anyway.

    I have a program which creates a window with a menu. If you click on an element of the menu (such as help -> about) then it displays some text. However, I'm not sure how to make that text dissapear when you click on another element of the menu. Any suggestions?

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,669
    Is this a console application or a GUI application? What OS? What compiler?

    gg

  3. #3
    Registered User
    Join Date
    Apr 2005
    Posts
    39
    Well, its not a console, so I'd guess its a GUI (not sure)

    My compiler is Dev C++

    My comp is windows xp.

  4. #4
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    If you click on an element of the menu (such as help -> about) then it displays some text.
    How is the text displayed?

    However, I'm not sure how to make that text dissapear when you click on another element of the menu. Any suggestions?
    I am going to assume you're talking about a Win32 program.

    If the text is part of a static control, use ShowWindow to make the control invisible, which hides the text.

    If the text is being drawn when you handle WM_PAINT, just stop drawing. This may require you to use a boolean variable.

  5. #5
    Registered User
    Join Date
    Apr 2005
    Posts
    39
    Quote Originally Posted by Dante Shamest
    How is the text displayed?



    I am going to assume you're talking about a Win32 program.

    If the text is part of a static control, use ShowWindow to make the control invisible, which hides the text.

    If the text is being drawn when you handle WM_PAINT, just stop drawing. This may require you to use a boolean variable.

    The text is displayed with the code:

    Code:
    TextOut(hdc,0,0,"Text",strlen("Text. Don't know why there is a second one..."));
    Yeah, i guess it is Win32... Since i'm sorta new to C++, all these abbreviations confuse me at times. Also, im not sure what you mean by that last paragraph.

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,669
    I highly suggest that you learn the language first - then learn to use the language to make GUI applications.

    gg

  7. #7
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    Quote Originally Posted by Olidivera
    Also, im not sure what you mean by that last paragraph.
    Something like this:

    Code:
    if ( canDraw )
      TextOut( ...etc... );
    where canDraw is a boolean variable:

    Code:
    bool canDraw;

  8. #8
    Registered User
    Join Date
    May 2005
    Posts
    28
    When do you draw the text? Ideally you should draw it when the WM_PAINT message is raised... then use an if like Dante said. You can explicitly call WM_PAINT by either using SendMessage or just InvalideRect() works well.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 03:56 PM
  2. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 09:18 PM
  3. clearing the screen
    By ssharish in forum C Programming
    Replies: 2
    Last Post: 02-01-2005, 08:00 PM
  4. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 02:41 AM
  5. Clearing the screen
    By Shadow in forum C Programming
    Replies: 4
    Last Post: 05-23-2002, 01:40 PM

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