Hiding Controls Dynamically in Dialog
-
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
-
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
-
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
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);
} -
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
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