Thread: Changing windows without changing?

  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    207

    Changing windows without changing?

    I've got a main screen for my game with 4 buttons: new, load, options, and quit.

    When the player clicks options, I was basically wanting to stay in the same window but erase everything and start over; maybe using a different handle and window procedure(?) The new window will be called (drum roll) the "Options Window" and have it's own stuff.

    My boss told me "You must change without changing, my son"

    He also said "If you cannot change without changing, it will be time for you to leave"

    Any ideas?

    mw
    Blucast Corporation

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    I think what you are wanting to do is to keep the new, load, options and quit items visible while changing an area of the screen to display the options when the options button is clicked. If this is correct then create a new window, perhaps a child window of the main window and display it where the options should be.
    You can have multiple windows with the same co-ordinates and use ShowWindow() to show/hide the window depending on which button the user clicked.
    Last edited by Quantum1024; 10-17-2005 at 03:04 AM.

  3. #3
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    What would be so bad about opening a new window on top of your old like any other windows application does ?
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  4. #4
    Registered User
    Join Date
    May 2005
    Posts
    207
    It's something I've seen in pc video games: you click the options button (or whatever) and everything on the window disappears and is replaced with something new. Usually there's a "transition effect" of some sort: the old controls fade or zoom off and disappear into the background and the new controls fade in or zoom IN to the screen from the background, etc. I don't need a fancy transition effect at this point though.

    The "old" window controls, background, etc are not visible when the new controls become visible.

    When the new controls are no longer used (ie: the user clicks "Return to Main Menu") then the new controls disappear and the old controls return.

    The point is the user doesn't detect a change in the window itself, merely a change in controls (and background, etc).

    I know, I know: it's crazy, impossible, nobody's ever done that, etc.

    Now how do I do it?

    mw
    Blucast Corporation

  5. #5
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    You can just destroy the current controls in the window with DestroyWindow.
    Or hide them with ShowWindow.

  6. #6
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Hide the current controls (or dialog),
    show the options controls (or dialog)
    process the options input.
    Hide the options dialog,
    Show the main ones.

    Make the option window/dlg modal. This means that the options window must be closed/finalised before the user can move on.

    >>Usually there's a "transition effect" of some sort
    Look at AnimateWindow()

    Another option is to move your options screen to the top of the z-order (and re-size to the current screen) with SetWindowPos().
    This will have the effect of hiding the current screen, unless the user moves them apart. As maximised that is not possible (or make sure it its not by handling the move msgs)
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  7. #7
    Registered User
    Join Date
    May 2005
    Posts
    207
    Thanks guys! I'll give that a try!

    mw
    Blucast Corporation

  8. #8
    Registered User
    Join Date
    May 2005
    Posts
    207
    Works great! And it was easy! :-)

    Still having centering problems with my new button though... :-(

    mw
    Blucast Corporation

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to make a windows application
    By crvenkapa in forum C++ Programming
    Replies: 3
    Last Post: 03-26-2007, 09:59 AM
  2. Script errors - bool unrecognized and struct issues
    By ulillillia in forum Windows Programming
    Replies: 10
    Last Post: 12-18-2006, 04:44 AM
  3. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM
  4. changing IE windows
    By major_small in forum Tech Board
    Replies: 4
    Last Post: 09-03-2003, 07:28 PM
  5. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 09:37 AM