Dialog items and hiding them

This is a discussion on Dialog items and hiding them within the Windows Programming forums, part of the Platform Specific Boards category; I am using MFC and wanting to hide dialog items and then show them later. I do not want to ...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Location
    Fort Worth, TX
    Posts
    53

    Dialog items and hiding them

    I am using MFC and wanting to hide dialog items and then show them later. I do not want to destroy them and recreate them. Is there a method out there that will handle these conditions.

    when button clicked

    CButton *button = (CButton*)GetDlgItem(IDOK);
    button->//NEED METHOD TO HIDE THIS BUTTON
    Do Some Stuff
    button->//NEED METHOD TO SHOW THIS BUTTON

  2. #2
    Unregistered
    Guest
    don't use mfc but CWnd etc may have a ShowWindow method. Failing that just use the ShowWindow API fn:


    ::ShowWindow(ButtonControl.m_hWnd,SW_HIDE);

    to show it again:

    ::ShowWindow(ButtonControl.m_hWnd,SW_SHOW);

  3. #3
    Registered User
    Join Date
    Aug 2001
    Location
    Fort Worth, TX
    Posts
    53
    MFC uses wrapper classes around the base win32 APIs. I was able to use the parameters for the API as to what I needed.
    What are the int values for SW_HIDE and SW_SHOW. I passed them and they worked fine, but wanted to know there value for extra info.

  4. #4
    Unregistered
    Guest
    Don't have a clue, off-hand. There a couple of ways to find out:

    1. look up 'ShowWindow', find the header it is declared in and look up the two defined values.

    2. int farty=SW_HIDE;
    int other_farty=SW_SHOW;

    If you have a debugger step to that point or, use a message box to display the values.

    Yes, I know, my variable naming scheme could be improved

    [ BTW I know mfc is thin, (arguably)crappy wrapper around win32 API. Try seeing if CFont actually releases an HFONT resource back to system for example of what I mean (this may have been corrected with vs_sp5 if you use msvc)]

    Anyway, have fun.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ShowWindow(SW_HIDE) problem
    By eXistenZ in forum Windows Programming
    Replies: 18
    Last Post: 09-05-2008, 10:31 AM
  2. Showing & hiding menu items
    By geek@02 in forum Windows Programming
    Replies: 1
    Last Post: 06-07-2005, 06:28 PM
  3. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM

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