Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Clean/Hide/Invisible Form while running

Clean/Hide/Invisible Form while running

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
13 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mohit 12
    wrote on last edited by
    #1

    Hello, I have Mfc application with formview and child dialog box. formview contains couple of everything(i.e checkbox,radio button,edit control,buttons) and Now I have dialog box, i want to hide all data in formview when i click in my dialog box(in simple way i want to get rid of all the buttons,checkbox and everything in formview when i click in dialog and if i click back to form they all should be back. I have tried, Hide,invisivle,showwindow and everything but that doesn't make sense to my problems since i do not want to hide or invisible my form, i want to hide or invisible the stuff inside formview. anyone got a clue? Help me. Thx, Cheers from canada.

    M R E S 4 Replies Last reply
    0
    • M mohit 12

      Hello, I have Mfc application with formview and child dialog box. formview contains couple of everything(i.e checkbox,radio button,edit control,buttons) and Now I have dialog box, i want to hide all data in formview when i click in my dialog box(in simple way i want to get rid of all the buttons,checkbox and everything in formview when i click in dialog and if i click back to form they all should be back. I have tried, Hide,invisivle,showwindow and everything but that doesn't make sense to my problems since i do not want to hide or invisible my form, i want to hide or invisible the stuff inside formview. anyone got a clue? Help me. Thx, Cheers from canada.

      M Offline
      M Offline
      Maximilien
      wrote on last edited by
      #2

      What's the relation between the dialog and the formview ? is it a modal dialog or a modeless dialog ? Why do you want to hide the different "everything" when the user clicks the dialog ? doesn't CWnd::ShowWindow(SW_HIDE); (or SW_SHOW) work ?

      Watched code never compiles.

      M 1 Reply Last reply
      0
      • M mohit 12

        Hello, I have Mfc application with formview and child dialog box. formview contains couple of everything(i.e checkbox,radio button,edit control,buttons) and Now I have dialog box, i want to hide all data in formview when i click in my dialog box(in simple way i want to get rid of all the buttons,checkbox and everything in formview when i click in dialog and if i click back to form they all should be back. I have tried, Hide,invisivle,showwindow and everything but that doesn't make sense to my problems since i do not want to hide or invisible my form, i want to hide or invisible the stuff inside formview. anyone got a clue? Help me. Thx, Cheers from canada.

        R Offline
        R Offline
        rahul kulshreshtha
        wrote on last edited by
        #3

        If you have added a member variable to you controls like button, check boxes then use below

          memberVariableName.ShowWindow(SW\_HIDE);
        

        If you have not added member variable then use below

          // first get a handle to your control
          CButton hBtn = (CButton \*) GetDlgItem(IDC\_Button1);
          hBtn->ShowWindow(SW\_HIDE);
        
        M 1 Reply Last reply
        0
        • M mohit 12

          Hello, I have Mfc application with formview and child dialog box. formview contains couple of everything(i.e checkbox,radio button,edit control,buttons) and Now I have dialog box, i want to hide all data in formview when i click in my dialog box(in simple way i want to get rid of all the buttons,checkbox and everything in formview when i click in dialog and if i click back to form they all should be back. I have tried, Hide,invisivle,showwindow and everything but that doesn't make sense to my problems since i do not want to hide or invisible my form, i want to hide or invisible the stuff inside formview. anyone got a clue? Help me. Thx, Cheers from canada.

          E Offline
          E Offline
          Emilio Garavaglia
          wrote on last edited by
          #4

          Don't invent "incredible and magic solutions" whose sole effect is to disorient the user. Just make the dialog modal!

          2 bugs found. > recompile ... 65534 bugs found. :doh:

          M 1 Reply Last reply
          0
          • M Maximilien

            What's the relation between the dialog and the formview ? is it a modal dialog or a modeless dialog ? Why do you want to hide the different "everything" when the user clicks the dialog ? doesn't CWnd::ShowWindow(SW_HIDE); (or SW_SHOW) work ?

            Watched code never compiles.

            M Offline
            M Offline
            mohit 12
            wrote on last edited by
            #5

            Here's what i have. I have formview and INSIDE that I have MyTabCtrl and Inside each tabs I have dialog, so apparently dialog is part of formview if i try to call(SW_SHOW) or (SW_HIDE) with formview's m_hWnd it will hide everything in form(wooops dialog too!) yes. it will also hide my dialog(tab control) which i want visible so it is not possible to use (sw_hide) or (sw_show) or any invisibility code for formview. What i want is when i double click on dialog box(which is part of tab control and tab control is inside formview) it suppose to hide all buttons and check box edit tools and everything which is visible on formview expect tab control and i have like 100 buttons and edit tools so it's not a good idea to get each item and hide or make them invisible it would make my complexity to it's highest level. thx for your time, cheers from canada

            1 Reply Last reply
            0
            • R rahul kulshreshtha

              If you have added a member variable to you controls like button, check boxes then use below

                memberVariableName.ShowWindow(SW\_HIDE);
              

              If you have not added member variable then use below

                // first get a handle to your control
                CButton hBtn = (CButton \*) GetDlgItem(IDC\_Button1);
                hBtn->ShowWindow(SW\_HIDE);
              
              M Offline
              M Offline
              mohit 12
              wrote on last edited by
              #6

              yes I defined all member variables, but it's not a good idea to take each member variables and hide/insivle them individually since i already said in last post i have 100+ buttons/edit control/check box and bunch of other things on form(it's scientific calculator, oh yea). so If there is another code or method to hide all buttons with one line of code(that would work ! :) ) thx for your time, cheers from canada.

              R 1 Reply Last reply
              0
              • E Emilio Garavaglia

                Don't invent "incredible and magic solutions" whose sole effect is to disorient the user. Just make the dialog modal!

                2 bugs found. > recompile ... 65534 bugs found. :doh:

                M Offline
                M Offline
                mohit 12
                wrote on last edited by
                #7

                making dialog modal will work ? :doh: I do not think so since i am dealing with formview. All I want IS hide all edit control/buttons and rest of things when i click on dialog box. thx for your time, cheers from canada.

                E 1 Reply Last reply
                0
                • M mohit 12

                  making dialog modal will work ? :doh: I do not think so since i am dealing with formview. All I want IS hide all edit control/buttons and rest of things when i click on dialog box. thx for your time, cheers from canada.

                  E Offline
                  E Offline
                  Emilio Garavaglia
                  wrote on last edited by
                  #8

                  Let me paraphrase your talk: "Entering the motorway the other side will work ?? I don think so: all I want to do is tell all those people coming against me to keep aside". The problem is not the formview, but the bad design that has been done initially. Even if you succeed in you intent, how many other application out there you know behaving that way? It is quite hard for a user that clicks somewhere and see something suddenly disappear to not be disoriented. If you want to go in that direction think to disable the buttons, not to hide them.

                  2 bugs found. > recompile ... 65534 bugs found. :doh:

                  M 1 Reply Last reply
                  0
                  • E Emilio Garavaglia

                    Let me paraphrase your talk: "Entering the motorway the other side will work ?? I don think so: all I want to do is tell all those people coming against me to keep aside". The problem is not the formview, but the bad design that has been done initially. Even if you succeed in you intent, how many other application out there you know behaving that way? It is quite hard for a user that clicks somewhere and see something suddenly disappear to not be disoriented. If you want to go in that direction think to disable the buttons, not to hide them.

                    2 bugs found. > recompile ... 65534 bugs found. :doh:

                    M Offline
                    M Offline
                    mohit 12
                    wrote on last edited by
                    #9

                    I think you haven't understand the issue yet. Problems is not bad desgining neither formview nor dialog box, User won't be shocked when everything disappear since graph will be maximized and doubleclicks again will get it back to original size and most of the application DO HAVE the feature of doubleclicking even in mainwindow if you double click the header it will be maximized and double clicking back will make it look normal, but I am trying to do that in dialog boxes, It's not hard it just need little more time efford and better understanding of MFC ( WHICH I DO NOT HAVE SINCE I STARTED IT LEARNING BY MYSELF SINCE MONTH ONLY) Yes disabling or hiding will not make much more diffrence since graph will be overlapped to them ( all i want is when i click just hide/disable/invisible or anything i just dont want them on formview LOL!) thx for your reply. appericiate it, RESPECT :thumbsup: cheers from canada.

                    1 Reply Last reply
                    0
                    • M mohit 12

                      yes I defined all member variables, but it's not a good idea to take each member variables and hide/insivle them individually since i already said in last post i have 100+ buttons/edit control/check box and bunch of other things on form(it's scientific calculator, oh yea). so If there is another code or method to hide all buttons with one line of code(that would work ! :) ) thx for your time, cheers from canada.

                      R Offline
                      R Offline
                      rahul kulshreshtha
                      wrote on last edited by
                      #10

                      Tryout this

                      BOOL CALLBACK HideAllChildren(HWND hwnd,LPARAM) {

                      ShowWindow(hwnd,SW_HIDE);
                      return TRUE;
                      }

                      void HideControls(HWND hDlg) {

                      EnumChildWindows(hDlg,HideAllChildren,0);
                      }

                      //...

                      HideControls(GetSafeHwnd());

                      or WinAPI Solution

                      for (CWnd *pwnd = GetWindow(GW_CHILD); pwnd != NULL; pwnd = pwnd->GetNextWindow(GW_HWNDNEXT))
                      {
                      //Insert your code here. pwnd is a pointer to control window.
                      }

                      1 Reply Last reply
                      0
                      • M mohit 12

                        Hello, I have Mfc application with formview and child dialog box. formview contains couple of everything(i.e checkbox,radio button,edit control,buttons) and Now I have dialog box, i want to hide all data in formview when i click in my dialog box(in simple way i want to get rid of all the buttons,checkbox and everything in formview when i click in dialog and if i click back to form they all should be back. I have tried, Hide,invisivle,showwindow and everything but that doesn't make sense to my problems since i do not want to hide or invisible my form, i want to hide or invisible the stuff inside formview. anyone got a clue? Help me. Thx, Cheers from canada.

                        S Offline
                        S Offline
                        Shivanand Gupta
                        wrote on last edited by
                        #11

                        GetDlgItem(ID_of button)->ShowWindow(SW_SHOW);//For show control GetDlgItem(ID_of button)->ShowWindow(SW_HIDE);//For Hide control

                        M 1 Reply Last reply
                        0
                        • S Shivanand Gupta

                          GetDlgItem(ID_of button)->ShowWindow(SW_SHOW);//For show control GetDlgItem(ID_of button)->ShowWindow(SW_HIDE);//For Hide control

                          M Offline
                          M Offline
                          mohit 12
                          wrote on last edited by
                          #12

                          thx for your reply. But i do not think that you have read my previous post, as i mentioned i have 100+ buttons so it's not a good idea to getdlgitem for all of them and hide them or show them because it would just make my code's complexity to 100+ which i do not want so if there is another way/idea to solve that problem please let me know. thx again, cheers from canada

                          S 1 Reply Last reply
                          0
                          • M mohit 12

                            thx for your reply. But i do not think that you have read my previous post, as i mentioned i have 100+ buttons so it's not a good idea to getdlgitem for all of them and hide them or show them because it would just make my code's complexity to 100+ which i do not want so if there is another way/idea to solve that problem please let me know. thx again, cheers from canada

                            S Offline
                            S Offline
                            Shivanand Gupta
                            wrote on last edited by
                            #13

                            if you have similar kind of control (button or editbox) then you can defined array of control variable. after that, using for loop you can hide / show the control. eg. CButton m_MyButton[200]; for(int i=0;i<200;i++) { m_MyButton[i].ShowWindow(SW_SHOW); }

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups