Making a visible control hidden during execution
Author |
Message |
rm #1 / 5
|
 Making a visible control hidden during execution
I have a dialog in a Regular MFC DLL. No problem access the DLL and all that, but I want to be able to set different characteristics of the dialog. For instance, in the Resource editor, everything is visible and enabled, but I want to be able to call some setup functions prior to the DoModal call of the dialog object that will disable and/or make the component invisible. I can't seem to find any methods that do this. For instance, if there is a check button that the application does not want to use and even see for that matter, I want to make it invisible and disable it so that the user has no idea about that component. If anyone has any suggestions I would appreciate it. Thanks in advance, rich
|
Mon, 31 Jul 2000 03:00:00 GMT |
|
 |
Douglas Peterso #2 / 5
|
 Making a visible control hidden during execution
In your dialog's OnInitDialog message handler you can either map your controls to control type members: m_MyEditControl.ShowWindow(SW_HIDE); or use GetDlgItem: CWnd* pWnd = GetDlgItem(IDC_MY_EDIT_CONTROL); pWnd->ShowWindow(SW_HIDE); Than you can show them at some other time. -- Douglas Peterson Software Engineer Telex Communications, Inc (For E-mail reply, remove the *'s) Quote:
>I have a dialog in a Regular MFC DLL. No problem access the DLL and all >that, but I want to be able to set different characteristics of the >dialog. For instance, in the Resource editor, everything is visible and >enabled, but I want to be able to call some setup functions prior to the >DoModal call of the dialog object that will disable and/or make the >component invisible. I can't seem to find any methods that do this. >For instance, if there is a check button that the application does not >want to use and even see for that matter, I want to make it invisible >and disable it so that the user has no idea about that component. If >anyone has any suggestions I would appreciate it. >Thanks in advance, >rich
|
Mon, 31 Jul 2000 03:00:00 GMT |
|
 |
Tom Serfac #3 / 5
|
 Making a visible control hidden during execution
Rich, Just call ShowWindow(SW_HIDE); to hide the control and ShowWindow(SW_SHOW); to show it again. GetDlgItem(ID_MYCONTROL)->ShowWindow(SW_HIDE); HTH, Tom Quote:
> I have a dialog in a Regular MFC DLL. No problem access the DLL and all > that, but I want to be able to set different characteristics of the > dialog. For instance, in the Resource editor, everything is visible and > enabled, but I want to be able to call some setup functions prior to the > DoModal call of the dialog object that will disable and/or make the > component invisible. I can't seem to find any methods that do this. > For instance, if there is a check button that the application does not > want to use and even see for that matter, I want to make it invisible > and disable it so that the user has no idea about that component. If > anyone has any suggestions I would appreciate it. > Thanks in advance, > rich
|
Mon, 31 Jul 2000 03:00:00 GMT |
|
 |
rm #4 / 5
|
 Making a visible control hidden during execution
Thanks. I actually figured that one out and then slapped my head, because it's soo easy. But my other obstacle is that it's easy to use ShowWindow on say a CButton because the resource has an object associated with it. But I would also like to hide any Group Boxes, which in this dialog (which I didn't write, so that's probably half the problem) does not have a control object associated with it. And it seems as though I don't know where or how to associate an object with the group box resource. For one, there is no CGroupBox, unless it's something like a button. thanks, rich Quote:
> Rich, > Just call ShowWindow(SW_HIDE); to hide the control and ShowWindow(SW_SHOW); > to show it again. > GetDlgItem(ID_MYCONTROL)->ShowWindow(SW_HIDE); > HTH, > Tom
> > I have a dialog in a Regular MFC DLL. No problem access the DLL and all > > that, but I want to be able to set different characteristics of the > > dialog. For instance, in the Resource editor, everything is visible and > > enabled, but I want to be able to call some setup functions prior to the > > DoModal call of the dialog object that will disable and/or make the > > component invisible. I can't seem to find any methods that do this. > > For instance, if there is a check button that the application does not > > want to use and even see for that matter, I want to make it invisible > > and disable it so that the user has no idea about that component. If > > anyone has any suggestions I would appreciate it. > > Thanks in advance, > > rich
|
Tue, 01 Aug 2000 03:00:00 GMT |
|
 |
Rail J. Rogu #5 / 5
|
 Making a visible control hidden during execution
Quote:
> Thanks. > I actually figured that one out and then slapped my head, because it's soo > easy. But my other obstacle is that it's easy to use ShowWindow on say a > CButton because the resource has an object associated with it. But I would > also like to hide any Group Boxes, which in this dialog (which I didn't write, > so that's probably half the problem) does not have a control object associated > with it. And it seems as though I don't know where or how to associate an > object with the group box resource. For one, there is no CGroupBox, unless > it's something like a button. > thanks, rich
> > Rich, > > Just call ShowWindow(SW_HIDE); to hide the control and ShowWindow(SW_SHOW); > > to show it again. > > GetDlgItem(ID_MYCONTROL)->ShowWindow(SW_HIDE); > > HTH, > > Tom
> > > I have a dialog in a Regular MFC DLL. No problem access the DLL and all > > > that, but I want to be able to set different characteristics of the > > > dialog. For instance, in the Resource editor, everything is visible and > > > enabled, but I want to be able to call some setup functions prior to the > > > DoModal call of the dialog object that will disable and/or make the > > > component invisible. I can't seem to find any methods that do this. > > > For instance, if there is a check button that the application does not > > > want to use and even see for that matter, I want to make it invisible > > > and disable it so that the user has no idea about that component. If > > > anyone has any suggestions I would appreciate it. > > > Thanks in advance, > > > rich
A group box normally has an ID = IDC_STATIC (-1), in the Resource Editor change this to something like IDC_GROUP, then you can create a Member Variable with ClassWizard of type Control which you can use to address the object. Rail -- Recording Engineer/Software Developer Rail Jon Rogut Software http://home.earthlink.net/~railro
|
Tue, 01 Aug 2000 03:00:00 GMT |
|
|
|