Hiding a button in a Dialog dynamically 
Author Message
 Hiding a button in a Dialog dynamically

Does anyone know how to dynamically show and hide a CButton object in a
CDialog object.  I would guess that one would use ShowWindow with SW_HIDE or
SW_SHOW arguments, but how does one acquire access to the embedded CButton?
Some example code would be appreciated.

Thank you.



Sat, 14 Sep 2002 03:00:00 GMT  
 Hiding a button in a Dialog dynamically
The code would look something like this:

CButton* pButton = (CButton*)GetDlgItem (IDD_OF_BUTTON);
pButton->ShowWindow (SW_HIDE);

Regards,

Brad


Quote:
> Does anyone know how to dynamically show and hide a CButton object in a
> CDialog object.  I would guess that one would use ShowWindow with SW_HIDE
or
> SW_SHOW arguments, but how does one acquire access to the embedded
CButton?
> Some example code would be appreciated.

> Thank you.



Sat, 14 Sep 2002 03:00:00 GMT  
 Hiding a button in a Dialog dynamically
To get your button, use GetDlgItem():

CWnd* pWnd = GetDlgItem(IDC_MY_BUTTON);
ASSERT_VALID(pWnd);
pWnd->ShowWindow(SW_HIDE);

--
Ajay Kalra

Microsoft VC++/MFC MVP

Note: Please post all replies to newsgroup only.

Quote:

> Does anyone know how to dynamically show and hide a CButton object in a
> CDialog object.  I would guess that one would use ShowWindow with SW_HIDE
or
> SW_SHOW arguments, but how does one acquire access to the embedded
CButton?
> Some example code would be appreciated.

> Thank you.



Sat, 14 Sep 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. dynamically show/hide toolbar button text

2. Dynamically Created Checkbox Button Does Not Appear on Dialog

3. Problems with default button on a dynamically created dialog

4. Add a button dynamically on the creation of a Dialog Box

5. Adding buttons dynamically to a dialog

6. adding buttons dynamically to a dialog

7. add button to dialog dynamically

8. Detecting dialog bar being hidden by command button

9. hiding dialog buttons

10. HOWTO: Hiding the OK button on an EVC dialog

11. Cannot hide a floating toolbar using Hide button

12. how to add button, edit control and spin button dynamically

 

 
Powered by phpBB® Forum Software