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. Hiding Controls Dynamically in Dialog

Hiding Controls Dynamically in Dialog

Scheduled Pinned Locked Moved C / C++ / MFC
questionwpf
4 Posts 4 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.
  • A Offline
    A Offline
    Anu_Bala
    wrote on last edited by
    #1

    Hi, I have single Dialog Templates with all controls using for 3 differnt types. For Controller-EditBox should be shown For Indicator-ComboBox should be shown For Switch-RadioButton should be shown. So when i invoke dialog for controller it will show editbox,indicator will show combobox . And What i want, if i invoke controller,then i will invoke indicator without closing the controller. THis is funcntinality i want. But what happened,after i clicked controller,when i click indicator it shows edit box only not ComBobox. If i first open indicator,and then controller shows only ComboBox not EditBox. How can i get that. I use UpdateData() in OnInitDialog,But no use.

    BOOL CFacePlate::OnInitDialog()
    {
    CDialog::OnInitDialog();
    UpdateData(FALSE);
    if(oTagBase->GetTagType()==CONTROLLER)
    {
    GetDlgItem(IDC_STATECOMBO)->ShowWindow(SW_HIDE);
    }
    if(oTagBase->GetTagType()==INDICATOR)
    {
    GetDlgItem(IDC_SPVALUE)->ShowWindow(SW_HIDE);
    }

    I have lot of controls like this.So i coded only to hide controls and not to show. Is there any solution?

    Anu

    L U D 3 Replies Last reply
    0
    • A Anu_Bala

      Hi, I have single Dialog Templates with all controls using for 3 differnt types. For Controller-EditBox should be shown For Indicator-ComboBox should be shown For Switch-RadioButton should be shown. So when i invoke dialog for controller it will show editbox,indicator will show combobox . And What i want, if i invoke controller,then i will invoke indicator without closing the controller. THis is funcntinality i want. But what happened,after i clicked controller,when i click indicator it shows edit box only not ComBobox. If i first open indicator,and then controller shows only ComboBox not EditBox. How can i get that. I use UpdateData() in OnInitDialog,But no use.

      BOOL CFacePlate::OnInitDialog()
      {
      CDialog::OnInitDialog();
      UpdateData(FALSE);
      if(oTagBase->GetTagType()==CONTROLLER)
      {
      GetDlgItem(IDC_STATECOMBO)->ShowWindow(SW_HIDE);
      }
      if(oTagBase->GetTagType()==INDICATOR)
      {
      GetDlgItem(IDC_SPVALUE)->ShowWindow(SW_HIDE);
      }

      I have lot of controls like this.So i coded only to hide controls and not to show. Is there any solution?

      Anu

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I would recommend you reading this article.

      Life is a stage and we are all actors!

      1 Reply Last reply
      0
      • A Anu_Bala

        Hi, I have single Dialog Templates with all controls using for 3 differnt types. For Controller-EditBox should be shown For Indicator-ComboBox should be shown For Switch-RadioButton should be shown. So when i invoke dialog for controller it will show editbox,indicator will show combobox . And What i want, if i invoke controller,then i will invoke indicator without closing the controller. THis is funcntinality i want. But what happened,after i clicked controller,when i click indicator it shows edit box only not ComBobox. If i first open indicator,and then controller shows only ComboBox not EditBox. How can i get that. I use UpdateData() in OnInitDialog,But no use.

        BOOL CFacePlate::OnInitDialog()
        {
        CDialog::OnInitDialog();
        UpdateData(FALSE);
        if(oTagBase->GetTagType()==CONTROLLER)
        {
        GetDlgItem(IDC_STATECOMBO)->ShowWindow(SW_HIDE);
        }
        if(oTagBase->GetTagType()==INDICATOR)
        {
        GetDlgItem(IDC_SPVALUE)->ShowWindow(SW_HIDE);
        }

        I have lot of controls like this.So i coded only to hide controls and not to show. Is there any solution?

        Anu

        U Offline
        U Offline
        User 3919723
        wrote on last edited by
        #3

        You have lot of controls? Why don't you use a function? Example:

        void CFacePlate::SetDlgItemVisible(int idCtrl, int iTagType)
        {
        if (oTagBase->GetTagType() == iTagType)
        {
        GetDlgItem(idCtrl)->ShowWindow(SW_SHOW);
        }
        else
        {
        GetDlgItem(idCtrl)->ShowWindow(SW_HIDE);
        }
        }

        BOOL CFacePlate::OnInitDialog()
        {
        CDialog::OnInitDialog();
        SetDlgItemVisible(IDC_STATECOMBO, INDICATOR);
        SetDlgItemVisible(IDC_SPVALUE, CONTROLLER);
        }

        1 Reply Last reply
        0
        • A Anu_Bala

          Hi, I have single Dialog Templates with all controls using for 3 differnt types. For Controller-EditBox should be shown For Indicator-ComboBox should be shown For Switch-RadioButton should be shown. So when i invoke dialog for controller it will show editbox,indicator will show combobox . And What i want, if i invoke controller,then i will invoke indicator without closing the controller. THis is funcntinality i want. But what happened,after i clicked controller,when i click indicator it shows edit box only not ComBobox. If i first open indicator,and then controller shows only ComboBox not EditBox. How can i get that. I use UpdateData() in OnInitDialog,But no use.

          BOOL CFacePlate::OnInitDialog()
          {
          CDialog::OnInitDialog();
          UpdateData(FALSE);
          if(oTagBase->GetTagType()==CONTROLLER)
          {
          GetDlgItem(IDC_STATECOMBO)->ShowWindow(SW_HIDE);
          }
          if(oTagBase->GetTagType()==INDICATOR)
          {
          GetDlgItem(IDC_SPVALUE)->ShowWindow(SW_HIDE);
          }

          I have lot of controls like this.So i coded only to hide controls and not to show. Is there any solution?

          Anu

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Anu_Bala wrote:

          UpdateData(FALSE);

          Remove this. It's rarely needed.

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "Man who follows car will be exhausted." - Confucius

          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