Enable/Disable A Window in SplitView :: MFC

kuphryn

Senior member
Jan 7, 2001
400
0
0
Hi.

I would like to know how to enable/disable a specific view inside a split window. For example, let there the split window comes default with three visible windows.

-----
View1
-----
View2
-----
View3
-----

If the user select an option in the menu to hide view2 or maybe a calculated needs to disable view2, is there a way to do that in MFC?

Most important that is the entire window must be redrawn. I am not sure how to redraw multiviews inside of main in SDI architecture.

Thanks,
Kuphryn

 

singh

Golden Member
Jul 5, 2001
1,449
0
0
There is no such thing as a "disabled" view. Well, I suppose it's possible to do, but it is not standard. As far as adding/removing views dynamically, it will involve some book-keeping.

Try the following articles:

Switching Views
Dynamic Views
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
If a view can have a Window handle, it can be disabled.

No mouse or keyboard messages will then be processed to it.
 

kuphryn

Senior member
Jan 7, 2001
400
0
0
Thanks.

Oh. You brought up a topic I have wondered about too.

How do you disable a view especially ignoring keyboard messages?

Kuphryn
 

singh

Golden Member
Jul 5, 2001
1,449
0
0
"Disabling" a view is meaningless. It serves no purpose. If you get to a situation that this needs to be done, then the program design is wrong. Off the top of my head, I can't think of any instances where you may want to disable a view.

When you disable dialog controls, the user can see that they are disabled just by looking at them. However, there is no such standard on how to represent disabled views (visually) - simply because it is not done.
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
To ignore keyboard, just trap the message WM_CHAR or WM_KEYDOWN and check a flag if you wish Windows to handle the message or ignore it.